diff --git a/bench/locli/src/Cardano/Util.hs b/bench/locli/src/Cardano/Util.hs index 47065a11c19..4ebe5fb44e1 100644 --- a/bench/locli/src/Cardano/Util.hs +++ b/bench/locli/src/Cardano/Util.hs @@ -1,6 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveFunctor #-} +{-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE GeneralisedNewtypeDeriving #-} {-# OPTIONS_GHC -Wno-orphans #-} {-# OPTIONS_GHC -Wno-incomplete-patterns #-} @@ -72,17 +73,26 @@ import Ouroboros.Consensus.Util.Time import Cardano.Ledger.BaseTypes (StrictMaybe (..), fromSMaybe) +deriving instance Generic1 I deriving newtype instance FromJSON a => (FromJSON (I a)) +deriving anyclass instance FromJSON1 I deriving newtype instance ToJSON a => (ToJSON (I a)) +deriving anyclass instance ToJSON1 I -- * Data.IntervalMap.FingerTree.Interval -- deriving instance Generic1 Interval -deriving instance FromJSON a => FromJSON (Interval a) -deriving instance FromJSON1 Interval +-- deriving instance AE.GFromJSON AE.One Interval +-- deriving instance AE.GToJSON' Value AE.One Interval +instance FromJSON a => FromJSON (Interval a) where + parseJSON = AE.genericParseJSON AE.defaultOptions +instance FromJSON1 Interval where + liftParseJSON = AE.genericLiftParseJSON AE.defaultOptions deriving instance Functor Interval -deriving instance ToJSON a => ToJSON (Interval a) -deriving instance ToJSON1 Interval +instance ToJSON a => ToJSON (Interval a) where + toJSON = AE.genericToJSON AE.defaultOptions +instance ToJSON1 Interval where + liftToJSON = AE.genericLiftToJSON AE.defaultOptions deriving instance NFData a => NFData (Interval a) unionIntv, intersectIntv :: Ord a => [Interval a] -> Interval a diff --git a/bench/locli/src/Data/DataDomain.hs b/bench/locli/src/Data/DataDomain.hs index 66e1558c0b8..2783170d5a5 100644 --- a/bench/locli/src/Data/DataDomain.hs +++ b/bench/locli/src/Data/DataDomain.hs @@ -1,5 +1,6 @@ {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveFunctor #-} +{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE QuantifiedConstraints #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-orphans -Wno-partial-fields #-} @@ -11,6 +12,7 @@ where import Cardano.Prelude import Witherable qualified as Wither +-- import Data.Aeson qualified as AE import Data.List.NonEmpty qualified as NE import Cardano.Util @@ -32,10 +34,19 @@ deriving instance (forall b. FromJSON b => FromJSON (f b), FromJSON a) => From deriving instance (forall b. ToJSON b => ToJSON (f b), ToJSON a) => ToJSON (DataDomain f a) deriving instance (forall b. NFData b => NFData (f b), NFData a) => NFData (DataDomain f a) deriving instance (forall b. Show b => Show (f b), Show a) => Show (DataDomain f a) -deriving instance (forall a. FromJSON a => FromJSON (f a), FromJSON1 f) => FromJSON1 (DataDomain f) -deriving instance FromJSON1 f => FromJSON1 (DataDomain f) -deriving instance (forall a. ToJSON a => ToJSON (f a), ToJSON1 f) => ToJSON1 (DataDomain f) -deriving instance ToJSON1 f => ToJSON1 (DataDomain f) + +-- instance {-# OVERLAPPABLE #-} (forall a. FromJSON a => FromJSON (f a)) => FromJSON1 (DataDomain f) where +-- liftParseJSON = AE.genericLiftParseJSON AE.defaultOptions +-- deriving instance {-# OVERLAPPABLE #-} FromJSON1 f => FromJSON1 (DataDomain f) + +-- instance {-# OVERLAPPABLE #-} (forall a. ToJSON a => ToJSON (f a)) => ToJSON1 (DataDomain f) where +-- liftToJSON = AE.genericLiftToJSON AE.defaultOptions +-- deriving instance {-# OVERLAPPABLE #-} ToJSON1 f => ToJSON1 (DataDomain f) + +-- instance {-# OVERLAPPABLE #-} (FromJSON1 f, FromJSON a) => FromJSON (f a) where +-- parseJSON = AE.parseJSON1 +-- instance {-# OVERLAPPABLE #-} (ToJSON1 f, ToJSON a) => ToJSON (f a) where +-- toJSON = AE.toJSON1 -- | Key decision of DataDomain merging policy. data DataDomainComb