{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE UndecidableSuperClasses #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Test.Cardano.Ledger.Constrained.Conway.Instances.Basic (
cSNothing_,
cSJust_,
succV_,
makePrices,
makeUnitInterval,
makeNonNegativeInterval,
SimplePParams (..),
SimplePPUpdate (..),
EraSpecPParams (..),
prettyE,
) where
import Cardano.Ledger.Alonzo.PParams
import Cardano.Ledger.BaseTypes hiding (inject)
import Cardano.Ledger.Coin
import Cardano.Ledger.Conway.Core
import Cardano.Ledger.Conway.Scripts ()
import Cardano.Ledger.Plutus.CostModels (CostModels)
import Cardano.Ledger.Plutus.ExUnits
import Cardano.Ledger.Shelley.PParams (ProposedPPUpdates (..))
import Constrained.API
import Constrained.Base
import Constrained.GenT
import Constrained.NumSpec
import Constrained.SumList (genListWithSize)
import Constrained.TheKnot
import Control.Monad.Identity (Identity (..))
import Control.Monad.Trans.Fail.String
import Data.Maybe
import Data.Ratio ((%))
import Data.TreeDiff
import Data.Typeable
import Data.Word
import GHC.Generics (Generic)
import Numeric.Natural (Natural)
import System.Random
import Test.Cardano.Ledger.Allegra.Arbitrary ()
import Test.Cardano.Ledger.Alonzo.Arbitrary ()
import Test.QuickCheck hiding (Args, Fun, NonZero, forAll)
import Text.PrettyPrint.HughesPJ (Doc)
prettyE :: ToExpr x => x -> Doc
prettyE :: forall x. ToExpr x => x -> Doc
prettyE x
x = Expr -> Doc
prettyExpr (x -> Expr
forall a. ToExpr a => a -> Expr
toExpr x
x)
makePrices :: Integer -> Integer -> Prices
makePrices :: Integer -> Integer -> Prices
makePrices Integer
x Integer
y = NonNegativeInterval -> NonNegativeInterval -> Prices
Prices (Maybe NonNegativeInterval -> NonNegativeInterval
forall a. HasCallStack => Maybe a -> a
fromJust (Rational -> Maybe NonNegativeInterval
forall r. BoundedRational r => Rational -> Maybe r
boundRational (Integer
x Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% Integer
1))) (Maybe NonNegativeInterval -> NonNegativeInterval
forall a. HasCallStack => Maybe a -> a
fromJust (Rational -> Maybe NonNegativeInterval
forall r. BoundedRational r => Rational -> Maybe r
boundRational (Integer
y Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% Integer
1)))
makeUnitInterval :: Integer -> Integer -> UnitInterval
makeUnitInterval :: Integer -> Integer -> UnitInterval
makeUnitInterval Integer
i Integer
j = Maybe UnitInterval -> UnitInterval
forall a. HasCallStack => Maybe a -> a
fromJust (Rational -> Maybe UnitInterval
forall r. BoundedRational r => Rational -> Maybe r
boundRational (Integer
i Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% Integer
j))
makeNonNegativeInterval :: Integer -> Integer -> NonNegativeInterval
makeNonNegativeInterval :: Integer -> Integer -> NonNegativeInterval
makeNonNegativeInterval Integer
i Integer
j = Maybe NonNegativeInterval -> NonNegativeInterval
forall a. HasCallStack => Maybe a -> a
fromJust (Rational -> Maybe NonNegativeInterval
forall r. BoundedRational r => Rational -> Maybe r
boundRational (Integer
i Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% Integer
j))
instance HasSimpleRep Coin where
type SimpleRep Coin = Word64
toSimpleRep :: Coin -> SimpleRep Coin
toSimpleRep (Coin Integer
i) = case Integer -> Maybe Word64
integerToWord64 Integer
i of
Maybe Word64
Nothing -> [Char] -> SimpleRep Coin
forall a. HasCallStack => [Char] -> a
error ([Char] -> SimpleRep Coin) -> [Char] -> SimpleRep Coin
forall a b. (a -> b) -> a -> b
$ [Char]
"The impossible happened in toSimpleRep for (Coin " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ Integer -> [Char]
forall a. Show a => a -> [Char]
show Integer
i [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
")"
Just Word64
w -> Word64
SimpleRep Coin
w
fromSimpleRep :: SimpleRep Coin -> Coin
fromSimpleRep = Word64 -> Coin
SimpleRep Coin -> Coin
word64ToCoin
instance HasSpec Coin
instance MaybeBounded Coin where
lowerBound :: Maybe Coin
lowerBound = Coin -> Maybe Coin
forall a. a -> Maybe a
Just (Word64 -> Coin
word64ToCoin Word64
0)
upperBound :: Maybe Coin
upperBound = Coin -> Maybe Coin
forall a. a -> Maybe a
Just (Word64 -> Coin
word64ToCoin (forall a. Bounded a => a
maxBound @Word64))
instance OrdLike Coin
instance NumLike Coin
instance Foldy Coin where
genList :: forall (m :: * -> *).
MonadGenError m =>
Specification Coin -> Specification Coin -> GenT m [Coin]
genList Specification Coin
s Specification Coin
s' = (Word64 -> Coin) -> [Word64] -> [Coin]
forall a b. (a -> b) -> [a] -> [b]
map Word64 -> Coin
SimpleRep Coin -> Coin
forall a. HasSimpleRep a => SimpleRep a -> a
fromSimpleRep ([Word64] -> [Coin]) -> GenT m [Word64] -> GenT m [Coin]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a (m :: * -> *).
(Foldy a, MonadGenError m) =>
Specification a -> Specification a -> GenT m [a]
genList @Word64 (Specification Coin -> Specification (SimpleRep Coin)
forall a.
GenericRequires a =>
Specification a -> Specification (SimpleRep a)
toSimpleRepSpec Specification Coin
s) (Specification Coin -> Specification (SimpleRep Coin)
forall a.
GenericRequires a =>
Specification a -> Specification (SimpleRep a)
toSimpleRepSpec Specification Coin
s')
theAddFn :: IntW '[Coin, Coin] Coin
theAddFn = IntW '[Coin, Coin] Coin
forall b. NumLike b => IntW '[b, b] b
AddW
theZero :: Coin
theZero = Integer -> Coin
Coin Integer
0
genSizedList :: forall (m :: * -> *).
MonadGenError m =>
Specification Integer
-> Specification Coin -> Specification Coin -> GenT m [Coin]
genSizedList Specification Integer
sz Specification Coin
elemSpec Specification Coin
foldSpec =
(Word64 -> Coin) -> [Word64] -> [Coin]
forall a b. (a -> b) -> [a] -> [b]
map Word64 -> Coin
SimpleRep Coin -> Coin
forall a. HasSimpleRep a => SimpleRep a -> a
fromSimpleRep
([Word64] -> [Coin]) -> GenT m [Word64] -> GenT m [Coin]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a (m :: * -> *).
(Complete a, TypeSpec a ~ NumSpec a, MonadGenError m, Random a,
Integral a, Arbitrary a, MaybeBounded a, Complete Integer,
TypeSpec Integer ~ NumSpec Integer) =>
Specification Integer
-> Specification a -> Specification a -> GenT m [a]
genListWithSize @Word64 Specification Integer
sz (Specification Coin -> Specification (SimpleRep Coin)
forall a.
GenericRequires a =>
Specification a -> Specification (SimpleRep a)
toSimpleRepSpec Specification Coin
elemSpec) (Specification Coin -> Specification (SimpleRep Coin)
forall a.
GenericRequires a =>
Specification a -> Specification (SimpleRep a)
toSimpleRepSpec Specification Coin
foldSpec)
noNegativeValues :: Bool
noNegativeValues = Bool
True
deriving via Integer instance Num Coin
instance Typeable a => HasSimpleRep (StrictMaybe a)
instance (HasSpec a, IsNormalType a) => HasSpec (StrictMaybe a)
cSNothing_ :: (HasSpec a, IsNormalType a) => Term (StrictMaybe a)
cSNothing_ :: forall a. (HasSpec a, IsNormalType a) => Term (StrictMaybe a)
cSNothing_ = forall (c :: Symbol) a r.
(SimpleRep a ~ SOP (TheSop a),
TypeSpec a ~ TypeSpec (SOP (TheSop a)),
TypeList (ConstrOf c (TheSop a)),
r ~ FunTy (MapList Term (ConstrOf c (TheSop a))) (Term a),
ResultType r ~ Term a, SOPTerm c (TheSop a),
ConstrTerm (ConstrOf c (TheSop a)), GenericRequires a) =>
r
con @"SNothing" (() -> Term ()
forall a. HasSpec a => a -> Term a
lit ())
cSJust_ :: (HasSpec a, IsNormalType a) => Term a -> Term (StrictMaybe a)
cSJust_ :: forall a.
(HasSpec a, IsNormalType a) =>
Term a -> Term (StrictMaybe a)
cSJust_ = forall (c :: Symbol) a r.
(SimpleRep a ~ SOP (TheSop a),
TypeSpec a ~ TypeSpec (SOP (TheSop a)),
TypeList (ConstrOf c (TheSop a)),
r ~ FunTy (MapList Term (ConstrOf c (TheSop a))) (Term a),
ResultType r ~ Term a, SOPTerm c (TheSop a),
ConstrTerm (ConstrOf c (TheSop a)), GenericRequires a) =>
r
con @"SJust"
instance HasSimpleRep EpochInterval
instance OrdLike EpochInterval
instance HasSpec EpochInterval
instance HasSpec UnitInterval where
type TypeSpec UnitInterval = ()
emptySpec :: TypeSpec UnitInterval
emptySpec = ()
combineSpec :: TypeSpec UnitInterval
-> TypeSpec UnitInterval -> Specification UnitInterval
combineSpec TypeSpec UnitInterval
_ TypeSpec UnitInterval
_ = Specification UnitInterval
forall deps a. SpecificationD deps a
TrueSpec
genFromTypeSpec :: forall (m :: * -> *).
(HasCallStack, MonadGenError m) =>
TypeSpec UnitInterval -> GenT m UnitInterval
genFromTypeSpec TypeSpec UnitInterval
_ = Gen UnitInterval -> GenT m UnitInterval
forall (m :: * -> *) a. Applicative m => Gen a -> GenT m a
pureGen Gen UnitInterval
forall a. Arbitrary a => Gen a
arbitrary
cardinalTypeSpec :: TypeSpec UnitInterval -> Specification Integer
cardinalTypeSpec TypeSpec UnitInterval
_ = Specification Integer
forall deps a. SpecificationD deps a
TrueSpec
shrinkWithTypeSpec :: TypeSpec UnitInterval -> UnitInterval -> [UnitInterval]
shrinkWithTypeSpec TypeSpec UnitInterval
_ = UnitInterval -> [UnitInterval]
forall a. Arbitrary a => a -> [a]
shrink
conformsTo :: HasCallStack => UnitInterval -> TypeSpec UnitInterval -> Bool
conformsTo UnitInterval
_ TypeSpec UnitInterval
_ = Bool
True
toPreds :: Term UnitInterval -> TypeSpec UnitInterval -> Pred
toPreds Term UnitInterval
_ TypeSpec UnitInterval
_ = Bool -> Pred
forall p. IsPred p => p -> Pred
toPred Bool
True
instance HasSpec NonNegativeInterval where
type TypeSpec NonNegativeInterval = ()
emptySpec :: TypeSpec NonNegativeInterval
emptySpec = ()
combineSpec :: TypeSpec NonNegativeInterval
-> TypeSpec NonNegativeInterval
-> Specification NonNegativeInterval
combineSpec TypeSpec NonNegativeInterval
_ TypeSpec NonNegativeInterval
_ = Specification NonNegativeInterval
forall deps a. SpecificationD deps a
TrueSpec
genFromTypeSpec :: forall (m :: * -> *).
(HasCallStack, MonadGenError m) =>
TypeSpec NonNegativeInterval -> GenT m NonNegativeInterval
genFromTypeSpec TypeSpec NonNegativeInterval
_ = Gen NonNegativeInterval -> GenT m NonNegativeInterval
forall (m :: * -> *) a. Applicative m => Gen a -> GenT m a
pureGen Gen NonNegativeInterval
forall a. Arbitrary a => Gen a
arbitrary
cardinalTypeSpec :: TypeSpec NonNegativeInterval -> Specification Integer
cardinalTypeSpec TypeSpec NonNegativeInterval
_ = Specification Integer
forall deps a. SpecificationD deps a
TrueSpec
shrinkWithTypeSpec :: TypeSpec NonNegativeInterval
-> NonNegativeInterval -> [NonNegativeInterval]
shrinkWithTypeSpec TypeSpec NonNegativeInterval
_ = NonNegativeInterval -> [NonNegativeInterval]
forall a. Arbitrary a => a -> [a]
shrink
conformsTo :: HasCallStack =>
NonNegativeInterval -> TypeSpec NonNegativeInterval -> Bool
conformsTo NonNegativeInterval
_ TypeSpec NonNegativeInterval
_ = Bool
True
toPreds :: Term NonNegativeInterval -> TypeSpec NonNegativeInterval -> Pred
toPreds Term NonNegativeInterval
_ TypeSpec NonNegativeInterval
_ = Bool -> Pred
forall p. IsPred p => p -> Pred
toPred Bool
True
instance HasSimpleRep CostModels
instance HasSpec CostModels where
type TypeSpec CostModels = ()
emptySpec :: TypeSpec CostModels
emptySpec = ()
combineSpec :: TypeSpec CostModels
-> TypeSpec CostModels -> Specification CostModels
combineSpec TypeSpec CostModels
_ TypeSpec CostModels
_ = Specification CostModels
forall deps a. SpecificationD deps a
TrueSpec
genFromTypeSpec :: forall (m :: * -> *).
(HasCallStack, MonadGenError m) =>
TypeSpec CostModels -> GenT m CostModels
genFromTypeSpec TypeSpec CostModels
_ = Gen CostModels -> GenT m CostModels
forall (m :: * -> *) a. Applicative m => Gen a -> GenT m a
pureGen Gen CostModels
forall a. Arbitrary a => Gen a
arbitrary
cardinalTypeSpec :: TypeSpec CostModels -> Specification Integer
cardinalTypeSpec TypeSpec CostModels
_ = Specification Integer
forall deps a. SpecificationD deps a
TrueSpec
shrinkWithTypeSpec :: TypeSpec CostModels -> CostModels -> [CostModels]
shrinkWithTypeSpec TypeSpec CostModels
_ = CostModels -> [CostModels]
forall a. Arbitrary a => a -> [a]
shrink
conformsTo :: HasCallStack => CostModels -> TypeSpec CostModels -> Bool
conformsTo CostModels
_ TypeSpec CostModels
_ = Bool
True
toPreds :: Term CostModels -> TypeSpec CostModels -> Pred
toPreds Term CostModels
_ TypeSpec CostModels
_ = Bool -> Pred
forall p. IsPred p => p -> Pred
toPred Bool
True
instance HasSimpleRep Prices
instance HasSpec Prices
instance HasSimpleRep ExUnits where
type SimpleRep ExUnits = SimpleRep (Natural, Natural)
fromSimpleRep :: SimpleRep ExUnits -> ExUnits
fromSimpleRep = (Natural -> Natural -> ExUnits) -> (Natural, Natural) -> ExUnits
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Natural -> Natural -> ExUnits
ExUnits ((Natural, Natural) -> ExUnits)
-> (Prod Natural Natural -> (Natural, Natural))
-> Prod Natural Natural
-> ExUnits
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SimpleRep (Natural, Natural) -> (Natural, Natural)
Prod Natural Natural -> (Natural, Natural)
forall a. HasSimpleRep a => SimpleRep a -> a
fromSimpleRep
toSimpleRep :: ExUnits -> SimpleRep ExUnits
toSimpleRep (ExUnits Natural
a Natural
b) = (Natural, Natural) -> SimpleRep (Natural, Natural)
forall a. HasSimpleRep a => a -> SimpleRep a
toSimpleRep (Natural
a, Natural
b)
instance HasSpec ExUnits
instance HasSimpleRep OrdExUnits where
type SimpleRep OrdExUnits = SimpleRep ExUnits
fromSimpleRep :: SimpleRep OrdExUnits -> OrdExUnits
fromSimpleRep = ExUnits -> OrdExUnits
OrdExUnits (ExUnits -> OrdExUnits)
-> (Prod Natural Natural -> ExUnits)
-> Prod Natural Natural
-> OrdExUnits
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SimpleRep ExUnits -> ExUnits
Prod Natural Natural -> ExUnits
forall a. HasSimpleRep a => SimpleRep a -> a
fromSimpleRep
toSimpleRep :: OrdExUnits -> SimpleRep OrdExUnits
toSimpleRep = ExUnits -> SimpleRep ExUnits
ExUnits -> Prod Natural Natural
forall a. HasSimpleRep a => a -> SimpleRep a
toSimpleRep (ExUnits -> Prod Natural Natural)
-> (OrdExUnits -> ExUnits) -> OrdExUnits -> Prod Natural Natural
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OrdExUnits -> ExUnits
unOrdExUnits
instance HasSpec OrdExUnits
instance HasSimpleRep PoolVotingThresholds
instance HasSpec PoolVotingThresholds
instance HasSimpleRep DRepVotingThresholds
instance HasSpec DRepVotingThresholds
instance HasSimpleRep ProtVer
instance HasSpec ProtVer
newtype VersionRep = VersionRep Word8
deriving (Int -> VersionRep -> [Char] -> [Char]
[VersionRep] -> [Char] -> [Char]
VersionRep -> [Char]
(Int -> VersionRep -> [Char] -> [Char])
-> (VersionRep -> [Char])
-> ([VersionRep] -> [Char] -> [Char])
-> Show VersionRep
forall a.
(Int -> a -> [Char] -> [Char])
-> (a -> [Char]) -> ([a] -> [Char] -> [Char]) -> Show a
$cshowsPrec :: Int -> VersionRep -> [Char] -> [Char]
showsPrec :: Int -> VersionRep -> [Char] -> [Char]
$cshow :: VersionRep -> [Char]
show :: VersionRep -> [Char]
$cshowList :: [VersionRep] -> [Char] -> [Char]
showList :: [VersionRep] -> [Char] -> [Char]
Show, VersionRep -> VersionRep -> Bool
(VersionRep -> VersionRep -> Bool)
-> (VersionRep -> VersionRep -> Bool) -> Eq VersionRep
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: VersionRep -> VersionRep -> Bool
== :: VersionRep -> VersionRep -> Bool
$c/= :: VersionRep -> VersionRep -> Bool
/= :: VersionRep -> VersionRep -> Bool
Eq, Eq VersionRep
Eq VersionRep =>
(VersionRep -> VersionRep -> Ordering)
-> (VersionRep -> VersionRep -> Bool)
-> (VersionRep -> VersionRep -> Bool)
-> (VersionRep -> VersionRep -> Bool)
-> (VersionRep -> VersionRep -> Bool)
-> (VersionRep -> VersionRep -> VersionRep)
-> (VersionRep -> VersionRep -> VersionRep)
-> Ord VersionRep
VersionRep -> VersionRep -> Bool
VersionRep -> VersionRep -> Ordering
VersionRep -> VersionRep -> VersionRep
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: VersionRep -> VersionRep -> Ordering
compare :: VersionRep -> VersionRep -> Ordering
$c< :: VersionRep -> VersionRep -> Bool
< :: VersionRep -> VersionRep -> Bool
$c<= :: VersionRep -> VersionRep -> Bool
<= :: VersionRep -> VersionRep -> Bool
$c> :: VersionRep -> VersionRep -> Bool
> :: VersionRep -> VersionRep -> Bool
$c>= :: VersionRep -> VersionRep -> Bool
>= :: VersionRep -> VersionRep -> Bool
$cmax :: VersionRep -> VersionRep -> VersionRep
max :: VersionRep -> VersionRep -> VersionRep
$cmin :: VersionRep -> VersionRep -> VersionRep
min :: VersionRep -> VersionRep -> VersionRep
Ord, Integer -> VersionRep
VersionRep -> VersionRep
VersionRep -> VersionRep -> VersionRep
(VersionRep -> VersionRep -> VersionRep)
-> (VersionRep -> VersionRep -> VersionRep)
-> (VersionRep -> VersionRep -> VersionRep)
-> (VersionRep -> VersionRep)
-> (VersionRep -> VersionRep)
-> (VersionRep -> VersionRep)
-> (Integer -> VersionRep)
-> Num VersionRep
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
$c+ :: VersionRep -> VersionRep -> VersionRep
+ :: VersionRep -> VersionRep -> VersionRep
$c- :: VersionRep -> VersionRep -> VersionRep
- :: VersionRep -> VersionRep -> VersionRep
$c* :: VersionRep -> VersionRep -> VersionRep
* :: VersionRep -> VersionRep -> VersionRep
$cnegate :: VersionRep -> VersionRep
negate :: VersionRep -> VersionRep
$cabs :: VersionRep -> VersionRep
abs :: VersionRep -> VersionRep
$csignum :: VersionRep -> VersionRep
signum :: VersionRep -> VersionRep
$cfromInteger :: Integer -> VersionRep
fromInteger :: Integer -> VersionRep
Num, (forall g.
RandomGen g =>
(VersionRep, VersionRep) -> g -> (VersionRep, g))
-> (forall g. RandomGen g => g -> (VersionRep, g))
-> (forall g.
RandomGen g =>
(VersionRep, VersionRep) -> g -> [VersionRep])
-> (forall g. RandomGen g => g -> [VersionRep])
-> Random VersionRep
forall g. RandomGen g => g -> [VersionRep]
forall g. RandomGen g => g -> (VersionRep, g)
forall g.
RandomGen g =>
(VersionRep, VersionRep) -> g -> [VersionRep]
forall g.
RandomGen g =>
(VersionRep, VersionRep) -> g -> (VersionRep, g)
forall a.
(forall g. RandomGen g => (a, a) -> g -> (a, g))
-> (forall g. RandomGen g => g -> (a, g))
-> (forall g. RandomGen g => (a, a) -> g -> [a])
-> (forall g. RandomGen g => g -> [a])
-> Random a
$crandomR :: forall g.
RandomGen g =>
(VersionRep, VersionRep) -> g -> (VersionRep, g)
randomR :: forall g.
RandomGen g =>
(VersionRep, VersionRep) -> g -> (VersionRep, g)
$crandom :: forall g. RandomGen g => g -> (VersionRep, g)
random :: forall g. RandomGen g => g -> (VersionRep, g)
$crandomRs :: forall g.
RandomGen g =>
(VersionRep, VersionRep) -> g -> [VersionRep]
randomRs :: forall g.
RandomGen g =>
(VersionRep, VersionRep) -> g -> [VersionRep]
$crandoms :: forall g. RandomGen g => g -> [VersionRep]
randoms :: forall g. RandomGen g => g -> [VersionRep]
Random, Gen VersionRep
Gen VersionRep
-> (VersionRep -> [VersionRep]) -> Arbitrary VersionRep
VersionRep -> [VersionRep]
forall a. Gen a -> (a -> [a]) -> Arbitrary a
$carbitrary :: Gen VersionRep
arbitrary :: Gen VersionRep
$cshrink :: VersionRep -> [VersionRep]
shrink :: VersionRep -> [VersionRep]
Arbitrary, Enum VersionRep
Real VersionRep
(Real VersionRep, Enum VersionRep) =>
(VersionRep -> VersionRep -> VersionRep)
-> (VersionRep -> VersionRep -> VersionRep)
-> (VersionRep -> VersionRep -> VersionRep)
-> (VersionRep -> VersionRep -> VersionRep)
-> (VersionRep -> VersionRep -> (VersionRep, VersionRep))
-> (VersionRep -> VersionRep -> (VersionRep, VersionRep))
-> (VersionRep -> Integer)
-> Integral VersionRep
VersionRep -> Integer
VersionRep -> VersionRep -> (VersionRep, VersionRep)
VersionRep -> VersionRep -> VersionRep
forall a.
(Real a, Enum a) =>
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
$cquot :: VersionRep -> VersionRep -> VersionRep
quot :: VersionRep -> VersionRep -> VersionRep
$crem :: VersionRep -> VersionRep -> VersionRep
rem :: VersionRep -> VersionRep -> VersionRep
$cdiv :: VersionRep -> VersionRep -> VersionRep
div :: VersionRep -> VersionRep -> VersionRep
$cmod :: VersionRep -> VersionRep -> VersionRep
mod :: VersionRep -> VersionRep -> VersionRep
$cquotRem :: VersionRep -> VersionRep -> (VersionRep, VersionRep)
quotRem :: VersionRep -> VersionRep -> (VersionRep, VersionRep)
$cdivMod :: VersionRep -> VersionRep -> (VersionRep, VersionRep)
divMod :: VersionRep -> VersionRep -> (VersionRep, VersionRep)
$ctoInteger :: VersionRep -> Integer
toInteger :: VersionRep -> Integer
Integral, Num VersionRep
Ord VersionRep
(Num VersionRep, Ord VersionRep) =>
(VersionRep -> Rational) -> Real VersionRep
VersionRep -> Rational
forall a. (Num a, Ord a) => (a -> Rational) -> Real a
$ctoRational :: VersionRep -> Rational
toRational :: VersionRep -> Rational
Real, Int -> VersionRep
VersionRep -> Int
VersionRep -> [VersionRep]
VersionRep -> VersionRep
VersionRep -> VersionRep -> [VersionRep]
VersionRep -> VersionRep -> VersionRep -> [VersionRep]
(VersionRep -> VersionRep)
-> (VersionRep -> VersionRep)
-> (Int -> VersionRep)
-> (VersionRep -> Int)
-> (VersionRep -> [VersionRep])
-> (VersionRep -> VersionRep -> [VersionRep])
-> (VersionRep -> VersionRep -> [VersionRep])
-> (VersionRep -> VersionRep -> VersionRep -> [VersionRep])
-> Enum VersionRep
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: VersionRep -> VersionRep
succ :: VersionRep -> VersionRep
$cpred :: VersionRep -> VersionRep
pred :: VersionRep -> VersionRep
$ctoEnum :: Int -> VersionRep
toEnum :: Int -> VersionRep
$cfromEnum :: VersionRep -> Int
fromEnum :: VersionRep -> Int
$cenumFrom :: VersionRep -> [VersionRep]
enumFrom :: VersionRep -> [VersionRep]
$cenumFromThen :: VersionRep -> VersionRep -> [VersionRep]
enumFromThen :: VersionRep -> VersionRep -> [VersionRep]
$cenumFromTo :: VersionRep -> VersionRep -> [VersionRep]
enumFromTo :: VersionRep -> VersionRep -> [VersionRep]
$cenumFromThenTo :: VersionRep -> VersionRep -> VersionRep -> [VersionRep]
enumFromThenTo :: VersionRep -> VersionRep -> VersionRep -> [VersionRep]
Enum) via Word8
instance HasSpec VersionRep where
type TypeSpec VersionRep = NumSpec VersionRep
emptySpec :: TypeSpec VersionRep
emptySpec = TypeSpec VersionRep
NumSpec VersionRep
forall a. Ord a => NumSpec a
emptyNumSpec
combineSpec :: TypeSpec VersionRep
-> TypeSpec VersionRep -> Specification VersionRep
combineSpec = TypeSpec VersionRep
-> TypeSpec VersionRep -> Specification VersionRep
NumSpec VersionRep
-> NumSpec VersionRep -> Specification VersionRep
forall n.
(HasSpec n, Ord n, TypeSpec n ~ NumSpec n) =>
NumSpec n -> NumSpec n -> Specification n
combineNumSpec
genFromTypeSpec :: forall (m :: * -> *).
(HasCallStack, MonadGenError m) =>
TypeSpec VersionRep -> GenT m VersionRep
genFromTypeSpec = TypeSpec VersionRep -> GenT m VersionRep
NumSpec VersionRep -> GenT m VersionRep
forall (m :: * -> *) n.
(MonadGenError m, Show n, Random n, Ord n, Num n,
MaybeBounded n) =>
NumSpec n -> GenT m n
genFromNumSpec
shrinkWithTypeSpec :: TypeSpec VersionRep -> VersionRep -> [VersionRep]
shrinkWithTypeSpec = TypeSpec VersionRep -> VersionRep -> [VersionRep]
NumSpec VersionRep -> VersionRep -> [VersionRep]
forall n. Arbitrary n => NumSpec n -> n -> [n]
shrinkWithNumSpec
conformsTo :: HasCallStack => VersionRep -> TypeSpec VersionRep -> Bool
conformsTo = VersionRep -> TypeSpec VersionRep -> Bool
VersionRep -> NumSpec VersionRep -> Bool
forall n. Ord n => n -> NumSpec n -> Bool
conformsToNumSpec
toPreds :: Term VersionRep -> TypeSpec VersionRep -> Pred
toPreds = Term VersionRep -> TypeSpec VersionRep -> Pred
Term VersionRep -> NumSpec VersionRep -> Pred
forall n. OrdLike n => Term n -> NumSpec n -> Pred
toPredsNumSpec
cardinalTypeSpec :: TypeSpec VersionRep -> Specification Integer
cardinalTypeSpec = TypeSpec VersionRep -> Specification Integer
NumSpec VersionRep -> Specification Integer
forall n.
(Integral n, MaybeBounded n) =>
NumSpec n -> Specification Integer
cardinalNumSpec
instance Bounded VersionRep where
minBound :: VersionRep
minBound = Word8 -> VersionRep
VersionRep (Word8 -> VersionRep) -> Word8 -> VersionRep
forall a b. (a -> b) -> a -> b
$ Version -> Word8
forall i. Integral i => Version -> i
getVersion Version
forall a. Bounded a => a
minBound
maxBound :: VersionRep
maxBound = Word8 -> VersionRep
VersionRep (Word8 -> VersionRep) -> Word8 -> VersionRep
forall a b. (a -> b) -> a -> b
$ Version -> Word8
forall i. Integral i => Version -> i
getVersion Version
forall a. Bounded a => a
maxBound
instance MaybeBounded VersionRep
instance HasSimpleRep Version where
type SimpleRep Version = VersionRep
fromSimpleRep :: SimpleRep Version -> Version
fromSimpleRep (VersionRep Word8
rep) = case Fail Version -> Either [Char] Version
forall a. Fail a -> Either [Char] a
runFail (Fail Version -> Either [Char] Version)
-> Fail Version -> Either [Char] Version
forall a b. (a -> b) -> a -> b
$ Word8 -> Fail Version
forall i (m :: * -> *). (Integral i, MonadFail m) => i -> m Version
mkVersion Word8
rep of
Left [Char]
err ->
[Char] -> Version
forall a. HasCallStack => [Char] -> a
error ([Char] -> Version) -> [Char] -> Version
forall a b. (a -> b) -> a -> b
$
[[Char]] -> [Char]
unlines
[ [Char]
"fromSimpleRep @Version:"
, Word8 -> [Char]
forall a. Show a => a -> [Char]
show Word8
rep
, [Char]
err
]
Right Version
a -> Version
a
toSimpleRep :: Version -> SimpleRep Version
toSimpleRep = Word8 -> VersionRep
VersionRep (Word8 -> VersionRep)
-> (Version -> Word8) -> Version -> VersionRep
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Version -> Word8
forall i. Integral i => Version -> i
getVersion
instance HasSpec Version
instance OrdLike Version
succV_ :: Term Version -> Term Version
succV_ :: Term Version -> Term Version
succV_ = Term (SimpleRep Version) -> Term Version
Term VersionRep -> Term Version
forall a.
(GenericRequires a, AppRequires BaseW '[SimpleRep a] a) =>
Term (SimpleRep a) -> Term a
fromGeneric_ (Term VersionRep -> Term Version)
-> (Term Version -> Term VersionRep)
-> Term Version
-> Term Version
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Term VersionRep -> Term VersionRep -> Term VersionRep
forall a. Num a => a -> a -> a
+ Term VersionRep
1) (Term VersionRep -> Term VersionRep)
-> (Term Version -> Term VersionRep)
-> Term Version
-> Term VersionRep
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Term Version -> Term (SimpleRep Version)
Term Version -> Term VersionRep
forall a. GenericRequires a => Term a -> Term (SimpleRep a)
toGeneric_
instance Typeable r => HasSpec (KeyHash r) where
type TypeSpec (KeyHash r) = ()
emptySpec :: TypeSpec (KeyHash r)
emptySpec = ()
combineSpec :: TypeSpec (KeyHash r)
-> TypeSpec (KeyHash r) -> Specification (KeyHash r)
combineSpec TypeSpec (KeyHash r)
_ TypeSpec (KeyHash r)
_ = Specification (KeyHash r)
forall deps a. SpecificationD deps a
TrueSpec
genFromTypeSpec :: forall (m :: * -> *).
(HasCallStack, MonadGenError m) =>
TypeSpec (KeyHash r) -> GenT m (KeyHash r)
genFromTypeSpec TypeSpec (KeyHash r)
_ = Gen (KeyHash r) -> GenT m (KeyHash r)
forall (m :: * -> *) a. Applicative m => Gen a -> GenT m a
pureGen Gen (KeyHash r)
forall a. Arbitrary a => Gen a
arbitrary
cardinalTypeSpec :: TypeSpec (KeyHash r) -> Specification Integer
cardinalTypeSpec TypeSpec (KeyHash r)
_ = Specification Integer
forall deps a. SpecificationD deps a
TrueSpec
shrinkWithTypeSpec :: TypeSpec (KeyHash r) -> KeyHash r -> [KeyHash r]
shrinkWithTypeSpec TypeSpec (KeyHash r)
_ = KeyHash r -> [KeyHash r]
forall a. Arbitrary a => a -> [a]
shrink
conformsTo :: HasCallStack => KeyHash r -> TypeSpec (KeyHash r) -> Bool
conformsTo KeyHash r
_ TypeSpec (KeyHash r)
_ = Bool
True
toPreds :: Term (KeyHash r) -> TypeSpec (KeyHash r) -> Pred
toPreds Term (KeyHash r)
_ TypeSpec (KeyHash r)
_ = Bool -> Pred
forall p. IsPred p => p -> Pred
toPred Bool
True
data SimplePParams era = SimplePParams
{ forall era. SimplePParams era -> Coin
minFeeA :: Coin
, forall era. SimplePParams era -> Coin
minFeeB :: Coin
, forall era. SimplePParams era -> Word32
maxBBSize :: Word32
, forall era. SimplePParams era -> Word32
maxTxSize :: Word32
, forall era. SimplePParams era -> Word32
maxBHSize :: Word32
, forall era. SimplePParams era -> Coin
keyDeposit :: Coin
, forall era. SimplePParams era -> Coin
poolDeposit :: Coin
, forall era. SimplePParams era -> EpochInterval
eMax :: EpochInterval
, forall era. SimplePParams era -> Word16
nOpt :: Word16
, forall era. SimplePParams era -> NonNegativeInterval
a0 :: NonNegativeInterval
, forall era. SimplePParams era -> UnitInterval
rho :: UnitInterval
, forall era. SimplePParams era -> UnitInterval
tau :: UnitInterval
, forall era. SimplePParams era -> UnitInterval
decentral :: UnitInterval
, forall era. SimplePParams era -> ProtVer
protocolVersion :: ProtVer
, forall era. SimplePParams era -> Coin
minUTxOValue :: Coin
, forall era. SimplePParams era -> Coin
minPoolCost :: Coin
, forall era. SimplePParams era -> Coin
coinsPerUTxOWord :: Coin
, forall era. SimplePParams era -> CostModels
costModels :: CostModels
, forall era. SimplePParams era -> Prices
prices :: Prices
, forall era. SimplePParams era -> ExUnits
maxTxExUnits :: ExUnits
, forall era. SimplePParams era -> ExUnits
maxBlockExUnits :: ExUnits
, forall era. SimplePParams era -> Natural
maxValSize :: Natural
, forall era. SimplePParams era -> Natural
collateralPercentage :: Natural
, forall era. SimplePParams era -> Natural
maxCollateralInputs :: Natural
, forall era. SimplePParams era -> Coin
coinsPerUTxOByte :: Coin
, forall era. SimplePParams era -> PoolVotingThresholds
poolVotingThresholds :: PoolVotingThresholds
, forall era. SimplePParams era -> DRepVotingThresholds
drepVotingThresholds :: DRepVotingThresholds
, forall era. SimplePParams era -> Natural
committeeMinSize :: Natural
, forall era. SimplePParams era -> EpochInterval
committeeMaxTermLength :: EpochInterval
, forall era. SimplePParams era -> EpochInterval
govActionLifetime :: EpochInterval
, forall era. SimplePParams era -> Coin
govActionDeposit :: Coin
, forall era. SimplePParams era -> Coin
dRepDeposit :: Coin
, forall era. SimplePParams era -> EpochInterval
dRepActivity :: EpochInterval
, forall era. SimplePParams era -> NonNegativeInterval
minFeeRefScriptCostPerByte :: NonNegativeInterval
}
deriving (SimplePParams era -> SimplePParams era -> Bool
(SimplePParams era -> SimplePParams era -> Bool)
-> (SimplePParams era -> SimplePParams era -> Bool)
-> Eq (SimplePParams era)
forall era. SimplePParams era -> SimplePParams era -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall era. SimplePParams era -> SimplePParams era -> Bool
== :: SimplePParams era -> SimplePParams era -> Bool
$c/= :: forall era. SimplePParams era -> SimplePParams era -> Bool
/= :: SimplePParams era -> SimplePParams era -> Bool
Eq, (forall x. SimplePParams era -> Rep (SimplePParams era) x)
-> (forall x. Rep (SimplePParams era) x -> SimplePParams era)
-> Generic (SimplePParams era)
forall x. Rep (SimplePParams era) x -> SimplePParams era
forall x. SimplePParams era -> Rep (SimplePParams era) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall era x. Rep (SimplePParams era) x -> SimplePParams era
forall era x. SimplePParams era -> Rep (SimplePParams era) x
$cfrom :: forall era x. SimplePParams era -> Rep (SimplePParams era) x
from :: forall x. SimplePParams era -> Rep (SimplePParams era) x
$cto :: forall era x. Rep (SimplePParams era) x -> SimplePParams era
to :: forall x. Rep (SimplePParams era) x -> SimplePParams era
Generic)
instance (EraSpecPParams era, EraGov era, EraTxOut era) => Show (SimplePParams era) where
show :: SimplePParams era -> [Char]
show SimplePParams era
x = PParams era -> [Char]
forall a. Show a => a -> [Char]
show (forall era. EraSpecPParams era => SimplePParams era -> PParams era
subsetToPP @era SimplePParams era
x)
instance HasSimpleRep (SimplePParams era)
instance (EraSpecPParams era, EraGov era, EraTxOut era) => HasSpec (SimplePParams era)
data SimplePPUpdate = SimplePPUpdate
{ SimplePPUpdate -> StrictMaybe Coin
uminFeeA :: StrictMaybe Coin
, SimplePPUpdate -> StrictMaybe Coin
uminFeeB :: StrictMaybe Coin
, SimplePPUpdate -> StrictMaybe Word32
umaxBBSize :: StrictMaybe Word32
, SimplePPUpdate -> StrictMaybe Word32
umaxTxSize :: StrictMaybe Word32
, SimplePPUpdate -> StrictMaybe Word32
umaxBHSize :: StrictMaybe Word32
, SimplePPUpdate -> StrictMaybe Coin
ukeyDeposit :: StrictMaybe Coin
, SimplePPUpdate -> StrictMaybe Coin
upoolDeposit :: StrictMaybe Coin
, SimplePPUpdate -> StrictMaybe EpochInterval
ueMax :: StrictMaybe EpochInterval
, SimplePPUpdate -> StrictMaybe Word16
unOpt :: StrictMaybe Word16
, SimplePPUpdate -> StrictMaybe NonNegativeInterval
ua0 :: StrictMaybe NonNegativeInterval
, SimplePPUpdate -> StrictMaybe UnitInterval
urho :: StrictMaybe UnitInterval
, SimplePPUpdate -> StrictMaybe UnitInterval
utau :: StrictMaybe UnitInterval
, SimplePPUpdate -> StrictMaybe UnitInterval
udecentral :: StrictMaybe UnitInterval
, SimplePPUpdate -> StrictMaybe ProtVer
uprotocolVersion :: StrictMaybe ProtVer
, SimplePPUpdate -> StrictMaybe Coin
uminUTxOValue :: StrictMaybe Coin
, SimplePPUpdate -> StrictMaybe Coin
uminPoolCost :: StrictMaybe Coin
,
SimplePPUpdate -> StrictMaybe Coin
ucoinsPerUTxOWord :: StrictMaybe Coin
, SimplePPUpdate -> StrictMaybe CostModels
ucostModels :: StrictMaybe CostModels
, SimplePPUpdate -> StrictMaybe Prices
uprices :: StrictMaybe Prices
, SimplePPUpdate -> StrictMaybe ExUnits
umaxTxExUnits :: StrictMaybe ExUnits
, SimplePPUpdate -> StrictMaybe ExUnits
umaxBlockExUnits :: StrictMaybe ExUnits
, SimplePPUpdate -> StrictMaybe Natural
umaxValSize :: StrictMaybe Natural
, SimplePPUpdate -> StrictMaybe Natural
ucollateralPercentage :: StrictMaybe Natural
, SimplePPUpdate -> StrictMaybe Natural
umaxCollateralInputs :: StrictMaybe Natural
,
SimplePPUpdate -> StrictMaybe Coin
ucoinsPerUTxOByte :: StrictMaybe Coin
,
SimplePPUpdate -> StrictMaybe PoolVotingThresholds
upoolVotingThresholds :: StrictMaybe PoolVotingThresholds
, SimplePPUpdate -> StrictMaybe DRepVotingThresholds
udrepVotingThresholds :: StrictMaybe DRepVotingThresholds
, SimplePPUpdate -> StrictMaybe Natural
ucommitteeMinSize :: StrictMaybe Natural
, SimplePPUpdate -> StrictMaybe EpochInterval
ucommitteeMaxTermLength :: StrictMaybe EpochInterval
, SimplePPUpdate -> StrictMaybe EpochInterval
ugovActionLifetime :: StrictMaybe EpochInterval
, SimplePPUpdate -> StrictMaybe Coin
ugovActionDeposit :: StrictMaybe Coin
, SimplePPUpdate -> StrictMaybe Coin
udRepDeposit :: StrictMaybe Coin
, SimplePPUpdate -> StrictMaybe EpochInterval
udRepActivity :: StrictMaybe EpochInterval
, SimplePPUpdate -> StrictMaybe NonNegativeInterval
uminFeeRefScriptCostPerByte :: StrictMaybe NonNegativeInterval
}
deriving (SimplePPUpdate -> SimplePPUpdate -> Bool
(SimplePPUpdate -> SimplePPUpdate -> Bool)
-> (SimplePPUpdate -> SimplePPUpdate -> Bool) -> Eq SimplePPUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SimplePPUpdate -> SimplePPUpdate -> Bool
== :: SimplePPUpdate -> SimplePPUpdate -> Bool
$c/= :: SimplePPUpdate -> SimplePPUpdate -> Bool
/= :: SimplePPUpdate -> SimplePPUpdate -> Bool
Eq, Int -> SimplePPUpdate -> [Char] -> [Char]
[SimplePPUpdate] -> [Char] -> [Char]
SimplePPUpdate -> [Char]
(Int -> SimplePPUpdate -> [Char] -> [Char])
-> (SimplePPUpdate -> [Char])
-> ([SimplePPUpdate] -> [Char] -> [Char])
-> Show SimplePPUpdate
forall a.
(Int -> a -> [Char] -> [Char])
-> (a -> [Char]) -> ([a] -> [Char] -> [Char]) -> Show a
$cshowsPrec :: Int -> SimplePPUpdate -> [Char] -> [Char]
showsPrec :: Int -> SimplePPUpdate -> [Char] -> [Char]
$cshow :: SimplePPUpdate -> [Char]
show :: SimplePPUpdate -> [Char]
$cshowList :: [SimplePPUpdate] -> [Char] -> [Char]
showList :: [SimplePPUpdate] -> [Char] -> [Char]
Show, (forall x. SimplePPUpdate -> Rep SimplePPUpdate x)
-> (forall x. Rep SimplePPUpdate x -> SimplePPUpdate)
-> Generic SimplePPUpdate
forall x. Rep SimplePPUpdate x -> SimplePPUpdate
forall x. SimplePPUpdate -> Rep SimplePPUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SimplePPUpdate -> Rep SimplePPUpdate x
from :: forall x. SimplePPUpdate -> Rep SimplePPUpdate x
$cto :: forall x. Rep SimplePPUpdate x -> SimplePPUpdate
to :: forall x. Rep SimplePPUpdate x -> SimplePPUpdate
Generic)
instance HasSimpleRep SimplePPUpdate
instance HasSpec SimplePPUpdate
instance EraSpecPParams era => HasSimpleRep (PParamsUpdate era) where
type SimpleRep (PParamsUpdate era) = SimplePPUpdate
toSimpleRep :: PParamsUpdate era -> SimpleRep (PParamsUpdate era)
toSimpleRep = PParamsUpdate era -> SimpleRep (PParamsUpdate era)
PParamsUpdate era -> SimplePPUpdate
forall era.
EraSpecPParams era =>
PParamsUpdate era -> SimplePPUpdate
ppuToUpdate
fromSimpleRep :: SimpleRep (PParamsUpdate era) -> PParamsUpdate era
fromSimpleRep = SimpleRep (PParamsUpdate era) -> PParamsUpdate era
SimplePPUpdate -> PParamsUpdate era
forall era.
EraSpecPParams era =>
SimplePPUpdate -> PParamsUpdate era
updateToPPU
instance EraSpecPParams era => HasSpec (PParamsUpdate era) where
genFromTypeSpec :: forall (m :: * -> *).
(HasCallStack, MonadGenError m) =>
TypeSpec (PParamsUpdate era) -> GenT m (PParamsUpdate era)
genFromTypeSpec TypeSpec (PParamsUpdate era)
x = SimpleRep (PParamsUpdate era) -> PParamsUpdate era
SimplePPUpdate -> PParamsUpdate era
forall a. HasSimpleRep a => SimpleRep a -> a
fromSimpleRep (SimplePPUpdate -> PParamsUpdate era)
-> GenT m SimplePPUpdate -> GenT m (PParamsUpdate era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeSpec SimplePPUpdate -> GenT m SimplePPUpdate
forall a (m :: * -> *).
(HasSpec a, HasCallStack, MonadGenError m) =>
TypeSpec a -> GenT m a
forall (m :: * -> *).
(HasCallStack, MonadGenError m) =>
TypeSpec SimplePPUpdate -> GenT m SimplePPUpdate
genFromTypeSpec TypeSpec (PParamsUpdate era)
TypeSpec SimplePPUpdate
x
instance EraSpecPParams era => HasSimpleRep (PParams era) where
type SimpleRep (PParams era) = SimplePParams era
toSimpleRep :: PParams era -> SimpleRep (PParams era)
toSimpleRep = PParams era -> SimpleRep (PParams era)
PParams era -> SimplePParams era
forall era. EraSpecPParams era => PParams era -> SimplePParams era
ppToSubset
fromSimpleRep :: SimpleRep (PParams era) -> PParams era
fromSimpleRep = SimpleRep (PParams era) -> PParams era
SimplePParams era -> PParams era
forall era. EraSpecPParams era => SimplePParams era -> PParams era
subsetToPP
instance (EraSpecPParams era, EraTxOut era, EraGov era) => HasSpec (PParams era) where
genFromTypeSpec :: forall (m :: * -> *).
(HasCallStack, MonadGenError m) =>
TypeSpec (PParams era) -> GenT m (PParams era)
genFromTypeSpec TypeSpec (PParams era)
x = SimpleRep (PParams era) -> PParams era
SimplePParams era -> PParams era
forall a. HasSimpleRep a => SimpleRep a -> a
fromSimpleRep (SimplePParams era -> PParams era)
-> GenT m (SimplePParams era) -> GenT m (PParams era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypeSpec (SimplePParams era) -> GenT m (SimplePParams era)
forall a (m :: * -> *).
(HasSpec a, HasCallStack, MonadGenError m) =>
TypeSpec a -> GenT m a
forall (m :: * -> *).
(HasCallStack, MonadGenError m) =>
TypeSpec (SimplePParams era) -> GenT m (SimplePParams era)
genFromTypeSpec TypeSpec (PParams era)
TypeSpec (SimplePParams era)
x
instance EraSpecPParams era => HasSimpleRep (ProposedPPUpdates era)
instance EraSpecPParams era => HasSpec (ProposedPPUpdates era)
instance EraSpecPParams era => HasSimpleRep (FuturePParams era)
instance (EraGov era, EraTxOut era, EraSpecPParams era) => HasSpec (FuturePParams era)
class
( Eq (PParamsHKD Identity era)
, Show (PParamsHKD Identity era)
, Eq (PParamsHKD StrictMaybe era)
, Show (PParamsHKD StrictMaybe era)
, EraPParams era
, EraTxOut era
, EraGov era
, EraTx era
) =>
EraSpecPParams era
where
subsetToPP :: SimplePParams era -> PParams era
ppToSubset :: PParams era -> SimplePParams era
updateToPPU :: SimplePPUpdate -> PParamsUpdate era
ppuToUpdate :: PParamsUpdate era -> SimplePPUpdate