{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE EmptyDataDeriving #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MonadComprehensions #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}

-- This is for the Hashable Set instance
{-# OPTIONS_GHC -Wno-orphans #-}

module Byron.Spec.Ledger.Update
  ( module Byron.Spec.Ledger.Update
  , PredicateFailure()
  )
where

import           NoThunks.Class (NoThunks(..))
import           Control.Arrow (second, (&&&))
import           Control.Monad (mzero)
import           Data.Bimap (Bimap, empty, lookupR)
import qualified Data.Bimap as Bimap
import           Data.Char (isAscii)
import           Data.Coerce (coerce)
import           Data.Data (Data, Typeable)
import           Data.Foldable (foldl', toList)
import           Data.Hashable (Hashable)
import qualified Data.Hashable as H
import           Data.Ix (inRange)
import           Data.List (sortOn)
import           Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import           Data.Maybe (catMaybes, fromMaybe)
import           Data.Ord (Down (Down))
import           Data.Set (Set, union, (\\))
import qualified Data.Set as Set
import           Data.Tuple (swap)
import           Data.Word (Word8)
import           GHC.Generics (Generic)
import           Hedgehog (Gen)
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Range as Range
import           Lens.Micro
import           Lens.Micro.Internal (Field1 (..), Field2 (..), Field3 (..))
import           Lens.Micro.Extras (view)
import           Lens.Micro.TH (makeLenses)
import           Numeric.Natural

import           Control.State.Transition
import           Control.State.Transition.Generator (HasTrace, SignalGenerator, envGen, sigGen,
                     tinkerWithSigGen)
import           Data.AbstractSize (HasTypeReps)

import           Byron.Spec.Ledger.Core (BlockCount (..), HasHash, Owner (Owner), Relation (..), Slot,
                     SlotCount (..), VKey (VKey), VKeyGenesis (VKeyGenesis), dom, hash, (*.), (-.),
                     (∈), (∉), (⋪), (▷), (▷<=), (▷>=), (◁), (⨃))
import qualified Byron.Spec.Ledger.Core as Core
import qualified Byron.Spec.Ledger.Core.Generators as CoreGen
import           Byron.Spec.Ledger.Core.Omniscient (skey)
import qualified Byron.Spec.Ledger.GlobalParams as GP
import           Byron.Spec.Ledger.Util (mkGoblinGens)

import           Test.Goblin (AddShrinks (..), GeneOps, Goblin (..), GoblinData, SeedGoblin (..),
                     mkEmptyGoblin, saveInBagOfTricks, tinkerRummagedOrConjureOrSave,
                     transcribeGenesAsInt, (<$$>))
import           Test.Goblin.TH (deriveAddShrinks, deriveGoblin, deriveSeedGoblin)

import           Prelude


newtype FactorA = FactorA Int
  deriving stock ((forall x. FactorA -> Rep FactorA x)
-> (forall x. Rep FactorA x -> FactorA) -> Generic FactorA
forall x. Rep FactorA x -> FactorA
forall x. FactorA -> Rep FactorA x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FactorA x -> FactorA
$cfrom :: forall x. FactorA -> Rep FactorA x
Generic, Int -> FactorA -> ShowS
[FactorA] -> ShowS
FactorA -> String
(Int -> FactorA -> ShowS)
-> (FactorA -> String) -> ([FactorA] -> ShowS) -> Show FactorA
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FactorA] -> ShowS
$cshowList :: [FactorA] -> ShowS
show :: FactorA -> String
$cshow :: FactorA -> String
showsPrec :: Int -> FactorA -> ShowS
$cshowsPrec :: Int -> FactorA -> ShowS
Show, Typeable FactorA
DataType
Constr
Typeable FactorA
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> FactorA -> c FactorA)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c FactorA)
-> (FactorA -> Constr)
-> (FactorA -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c FactorA))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FactorA))
-> ((forall b. Data b => b -> b) -> FactorA -> FactorA)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> FactorA -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> FactorA -> r)
-> (forall u. (forall d. Data d => d -> u) -> FactorA -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> FactorA -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> FactorA -> m FactorA)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FactorA -> m FactorA)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FactorA -> m FactorA)
-> Data FactorA
FactorA -> DataType
FactorA -> Constr
(forall b. Data b => b -> b) -> FactorA -> FactorA
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FactorA -> c FactorA
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FactorA
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> FactorA -> u
forall u. (forall d. Data d => d -> u) -> FactorA -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FactorA -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FactorA -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FactorA -> m FactorA
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FactorA -> m FactorA
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FactorA
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FactorA -> c FactorA
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FactorA)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FactorA)
$cFactorA :: Constr
$tFactorA :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> FactorA -> m FactorA
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FactorA -> m FactorA
gmapMp :: (forall d. Data d => d -> m d) -> FactorA -> m FactorA
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FactorA -> m FactorA
gmapM :: (forall d. Data d => d -> m d) -> FactorA -> m FactorA
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FactorA -> m FactorA
gmapQi :: Int -> (forall d. Data d => d -> u) -> FactorA -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FactorA -> u
gmapQ :: (forall d. Data d => d -> u) -> FactorA -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FactorA -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FactorA -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FactorA -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FactorA -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FactorA -> r
gmapT :: (forall b. Data b => b -> b) -> FactorA -> FactorA
$cgmapT :: (forall b. Data b => b -> b) -> FactorA -> FactorA
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FactorA)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FactorA)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c FactorA)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FactorA)
dataTypeOf :: FactorA -> DataType
$cdataTypeOf :: FactorA -> DataType
toConstr :: FactorA -> Constr
$ctoConstr :: FactorA -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FactorA
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FactorA
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FactorA -> c FactorA
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FactorA -> c FactorA
$cp1Data :: Typeable FactorA
Data, Typeable)
  deriving newtype (FactorA -> FactorA -> Bool
(FactorA -> FactorA -> Bool)
-> (FactorA -> FactorA -> Bool) -> Eq FactorA
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FactorA -> FactorA -> Bool
$c/= :: FactorA -> FactorA -> Bool
== :: FactorA -> FactorA -> Bool
$c== :: FactorA -> FactorA -> Bool
Eq, Eq FactorA
Eq FactorA
-> (FactorA -> FactorA -> Ordering)
-> (FactorA -> FactorA -> Bool)
-> (FactorA -> FactorA -> Bool)
-> (FactorA -> FactorA -> Bool)
-> (FactorA -> FactorA -> Bool)
-> (FactorA -> FactorA -> FactorA)
-> (FactorA -> FactorA -> FactorA)
-> Ord FactorA
FactorA -> FactorA -> Bool
FactorA -> FactorA -> Ordering
FactorA -> FactorA -> FactorA
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
min :: FactorA -> FactorA -> FactorA
$cmin :: FactorA -> FactorA -> FactorA
max :: FactorA -> FactorA -> FactorA
$cmax :: FactorA -> FactorA -> FactorA
>= :: FactorA -> FactorA -> Bool
$c>= :: FactorA -> FactorA -> Bool
> :: FactorA -> FactorA -> Bool
$c> :: FactorA -> FactorA -> Bool
<= :: FactorA -> FactorA -> Bool
$c<= :: FactorA -> FactorA -> Bool
< :: FactorA -> FactorA -> Bool
$c< :: FactorA -> FactorA -> Bool
compare :: FactorA -> FactorA -> Ordering
$ccompare :: FactorA -> FactorA -> Ordering
$cp1Ord :: Eq FactorA
Ord, Int -> FactorA -> Int
FactorA -> Int
(Int -> FactorA -> Int) -> (FactorA -> Int) -> Hashable FactorA
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: FactorA -> Int
$chash :: FactorA -> Int
hashWithSalt :: Int -> FactorA -> Int
$chashWithSalt :: Int -> FactorA -> Int
Hashable, Context -> FactorA -> IO (Maybe ThunkInfo)
Proxy FactorA -> String
(Context -> FactorA -> IO (Maybe ThunkInfo))
-> (Context -> FactorA -> IO (Maybe ThunkInfo))
-> (Proxy FactorA -> String)
-> NoThunks FactorA
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy FactorA -> String
$cshowTypeOf :: Proxy FactorA -> String
wNoThunks :: Context -> FactorA -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> FactorA -> IO (Maybe ThunkInfo)
noThunks :: Context -> FactorA -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> FactorA -> IO (Maybe ThunkInfo)
NoThunks)
  deriving anyclass (FactorA -> Seq TypeRep
(FactorA -> Seq TypeRep) -> HasTypeReps FactorA
forall a. (a -> Seq TypeRep) -> HasTypeReps a
typeReps :: FactorA -> Seq TypeRep
$ctypeReps :: FactorA -> Seq TypeRep
HasTypeReps)

newtype FactorB = FactorB Int
  deriving stock ((forall x. FactorB -> Rep FactorB x)
-> (forall x. Rep FactorB x -> FactorB) -> Generic FactorB
forall x. Rep FactorB x -> FactorB
forall x. FactorB -> Rep FactorB x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FactorB x -> FactorB
$cfrom :: forall x. FactorB -> Rep FactorB x
Generic, Int -> FactorB -> ShowS
[FactorB] -> ShowS
FactorB -> String
(Int -> FactorB -> ShowS)
-> (FactorB -> String) -> ([FactorB] -> ShowS) -> Show FactorB
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FactorB] -> ShowS
$cshowList :: [FactorB] -> ShowS
show :: FactorB -> String
$cshow :: FactorB -> String
showsPrec :: Int -> FactorB -> ShowS
$cshowsPrec :: Int -> FactorB -> ShowS
Show, Typeable FactorB
DataType
Constr
Typeable FactorB
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> FactorB -> c FactorB)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c FactorB)
-> (FactorB -> Constr)
-> (FactorB -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c FactorB))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FactorB))
-> ((forall b. Data b => b -> b) -> FactorB -> FactorB)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> FactorB -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> FactorB -> r)
-> (forall u. (forall d. Data d => d -> u) -> FactorB -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> FactorB -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> FactorB -> m FactorB)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FactorB -> m FactorB)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FactorB -> m FactorB)
-> Data FactorB
FactorB -> DataType
FactorB -> Constr
(forall b. Data b => b -> b) -> FactorB -> FactorB
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FactorB -> c FactorB
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FactorB
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> FactorB -> u
forall u. (forall d. Data d => d -> u) -> FactorB -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FactorB -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FactorB -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FactorB -> m FactorB
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FactorB -> m FactorB
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FactorB
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FactorB -> c FactorB
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FactorB)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FactorB)
$cFactorB :: Constr
$tFactorB :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> FactorB -> m FactorB
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FactorB -> m FactorB
gmapMp :: (forall d. Data d => d -> m d) -> FactorB -> m FactorB
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FactorB -> m FactorB
gmapM :: (forall d. Data d => d -> m d) -> FactorB -> m FactorB
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FactorB -> m FactorB
gmapQi :: Int -> (forall d. Data d => d -> u) -> FactorB -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FactorB -> u
gmapQ :: (forall d. Data d => d -> u) -> FactorB -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FactorB -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FactorB -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FactorB -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FactorB -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FactorB -> r
gmapT :: (forall b. Data b => b -> b) -> FactorB -> FactorB
$cgmapT :: (forall b. Data b => b -> b) -> FactorB -> FactorB
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FactorB)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FactorB)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c FactorB)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FactorB)
dataTypeOf :: FactorB -> DataType
$cdataTypeOf :: FactorB -> DataType
toConstr :: FactorB -> Constr
$ctoConstr :: FactorB -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FactorB
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FactorB
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FactorB -> c FactorB
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FactorB -> c FactorB
$cp1Data :: Typeable FactorB
Data, Typeable)
  deriving newtype (FactorB -> FactorB -> Bool
(FactorB -> FactorB -> Bool)
-> (FactorB -> FactorB -> Bool) -> Eq FactorB
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FactorB -> FactorB -> Bool
$c/= :: FactorB -> FactorB -> Bool
== :: FactorB -> FactorB -> Bool
$c== :: FactorB -> FactorB -> Bool
Eq, Eq FactorB
Eq FactorB
-> (FactorB -> FactorB -> Ordering)
-> (FactorB -> FactorB -> Bool)
-> (FactorB -> FactorB -> Bool)
-> (FactorB -> FactorB -> Bool)
-> (FactorB -> FactorB -> Bool)
-> (FactorB -> FactorB -> FactorB)
-> (FactorB -> FactorB -> FactorB)
-> Ord FactorB
FactorB -> FactorB -> Bool
FactorB -> FactorB -> Ordering
FactorB -> FactorB -> FactorB
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
min :: FactorB -> FactorB -> FactorB
$cmin :: FactorB -> FactorB -> FactorB
max :: FactorB -> FactorB -> FactorB
$cmax :: FactorB -> FactorB -> FactorB
>= :: FactorB -> FactorB -> Bool
$c>= :: FactorB -> FactorB -> Bool
> :: FactorB -> FactorB -> Bool
$c> :: FactorB -> FactorB -> Bool
<= :: FactorB -> FactorB -> Bool
$c<= :: FactorB -> FactorB -> Bool
< :: FactorB -> FactorB -> Bool
$c< :: FactorB -> FactorB -> Bool
compare :: FactorB -> FactorB -> Ordering
$ccompare :: FactorB -> FactorB -> Ordering
$cp1Ord :: Eq FactorB
Ord, Int -> FactorB -> Int
FactorB -> Int
(Int -> FactorB -> Int) -> (FactorB -> Int) -> Hashable FactorB
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: FactorB -> Int
$chash :: FactorB -> Int
hashWithSalt :: Int -> FactorB -> Int
$chashWithSalt :: Int -> FactorB -> Int
Hashable, Context -> FactorB -> IO (Maybe ThunkInfo)
Proxy FactorB -> String
(Context -> FactorB -> IO (Maybe ThunkInfo))
-> (Context -> FactorB -> IO (Maybe ThunkInfo))
-> (Proxy FactorB -> String)
-> NoThunks FactorB
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy FactorB -> String
$cshowTypeOf :: Proxy FactorB -> String
wNoThunks :: Context -> FactorB -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> FactorB -> IO (Maybe ThunkInfo)
noThunks :: Context -> FactorB -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> FactorB -> IO (Maybe ThunkInfo)
NoThunks)
  deriving anyclass (FactorB -> Seq TypeRep
(FactorB -> Seq TypeRep) -> HasTypeReps FactorB
forall a. (a -> Seq TypeRep) -> HasTypeReps a
typeReps :: FactorB -> Seq TypeRep
$ctypeReps :: FactorB -> Seq TypeRep
HasTypeReps)

newtype UpAdptThd = UpAdptThd Double
  deriving stock ((forall x. UpAdptThd -> Rep UpAdptThd x)
-> (forall x. Rep UpAdptThd x -> UpAdptThd) -> Generic UpAdptThd
forall x. Rep UpAdptThd x -> UpAdptThd
forall x. UpAdptThd -> Rep UpAdptThd x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpAdptThd x -> UpAdptThd
$cfrom :: forall x. UpAdptThd -> Rep UpAdptThd x
Generic, Int -> UpAdptThd -> ShowS
[UpAdptThd] -> ShowS
UpAdptThd -> String
(Int -> UpAdptThd -> ShowS)
-> (UpAdptThd -> String)
-> ([UpAdptThd] -> ShowS)
-> Show UpAdptThd
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpAdptThd] -> ShowS
$cshowList :: [UpAdptThd] -> ShowS
show :: UpAdptThd -> String
$cshow :: UpAdptThd -> String
showsPrec :: Int -> UpAdptThd -> ShowS
$cshowsPrec :: Int -> UpAdptThd -> ShowS
Show, Typeable UpAdptThd
DataType
Constr
Typeable UpAdptThd
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> UpAdptThd -> c UpAdptThd)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UpAdptThd)
-> (UpAdptThd -> Constr)
-> (UpAdptThd -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UpAdptThd))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UpAdptThd))
-> ((forall b. Data b => b -> b) -> UpAdptThd -> UpAdptThd)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> UpAdptThd -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> UpAdptThd -> r)
-> (forall u. (forall d. Data d => d -> u) -> UpAdptThd -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> UpAdptThd -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> UpAdptThd -> m UpAdptThd)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UpAdptThd -> m UpAdptThd)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UpAdptThd -> m UpAdptThd)
-> Data UpAdptThd
UpAdptThd -> DataType
UpAdptThd -> Constr
(forall b. Data b => b -> b) -> UpAdptThd -> UpAdptThd
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UpAdptThd -> c UpAdptThd
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpAdptThd
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> UpAdptThd -> u
forall u. (forall d. Data d => d -> u) -> UpAdptThd -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpAdptThd -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpAdptThd -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UpAdptThd -> m UpAdptThd
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UpAdptThd -> m UpAdptThd
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpAdptThd
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UpAdptThd -> c UpAdptThd
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UpAdptThd)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UpAdptThd)
$cUpAdptThd :: Constr
$tUpAdptThd :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> UpAdptThd -> m UpAdptThd
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UpAdptThd -> m UpAdptThd
gmapMp :: (forall d. Data d => d -> m d) -> UpAdptThd -> m UpAdptThd
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UpAdptThd -> m UpAdptThd
gmapM :: (forall d. Data d => d -> m d) -> UpAdptThd -> m UpAdptThd
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UpAdptThd -> m UpAdptThd
gmapQi :: Int -> (forall d. Data d => d -> u) -> UpAdptThd -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> UpAdptThd -> u
gmapQ :: (forall d. Data d => d -> u) -> UpAdptThd -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> UpAdptThd -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpAdptThd -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpAdptThd -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpAdptThd -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpAdptThd -> r
gmapT :: (forall b. Data b => b -> b) -> UpAdptThd -> UpAdptThd
$cgmapT :: (forall b. Data b => b -> b) -> UpAdptThd -> UpAdptThd
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UpAdptThd)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UpAdptThd)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UpAdptThd)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UpAdptThd)
dataTypeOf :: UpAdptThd -> DataType
$cdataTypeOf :: UpAdptThd -> DataType
toConstr :: UpAdptThd -> Constr
$ctoConstr :: UpAdptThd -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpAdptThd
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpAdptThd
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UpAdptThd -> c UpAdptThd
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UpAdptThd -> c UpAdptThd
$cp1Data :: Typeable UpAdptThd
Data, Typeable)
  deriving newtype (UpAdptThd -> UpAdptThd -> Bool
(UpAdptThd -> UpAdptThd -> Bool)
-> (UpAdptThd -> UpAdptThd -> Bool) -> Eq UpAdptThd
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpAdptThd -> UpAdptThd -> Bool
$c/= :: UpAdptThd -> UpAdptThd -> Bool
== :: UpAdptThd -> UpAdptThd -> Bool
$c== :: UpAdptThd -> UpAdptThd -> Bool
Eq, Eq UpAdptThd
Eq UpAdptThd
-> (UpAdptThd -> UpAdptThd -> Ordering)
-> (UpAdptThd -> UpAdptThd -> Bool)
-> (UpAdptThd -> UpAdptThd -> Bool)
-> (UpAdptThd -> UpAdptThd -> Bool)
-> (UpAdptThd -> UpAdptThd -> Bool)
-> (UpAdptThd -> UpAdptThd -> UpAdptThd)
-> (UpAdptThd -> UpAdptThd -> UpAdptThd)
-> Ord UpAdptThd
UpAdptThd -> UpAdptThd -> Bool
UpAdptThd -> UpAdptThd -> Ordering
UpAdptThd -> UpAdptThd -> UpAdptThd
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
min :: UpAdptThd -> UpAdptThd -> UpAdptThd
$cmin :: UpAdptThd -> UpAdptThd -> UpAdptThd
max :: UpAdptThd -> UpAdptThd -> UpAdptThd
$cmax :: UpAdptThd -> UpAdptThd -> UpAdptThd
>= :: UpAdptThd -> UpAdptThd -> Bool
$c>= :: UpAdptThd -> UpAdptThd -> Bool
> :: UpAdptThd -> UpAdptThd -> Bool
$c> :: UpAdptThd -> UpAdptThd -> Bool
<= :: UpAdptThd -> UpAdptThd -> Bool
$c<= :: UpAdptThd -> UpAdptThd -> Bool
< :: UpAdptThd -> UpAdptThd -> Bool
$c< :: UpAdptThd -> UpAdptThd -> Bool
compare :: UpAdptThd -> UpAdptThd -> Ordering
$ccompare :: UpAdptThd -> UpAdptThd -> Ordering
$cp1Ord :: Eq UpAdptThd
Ord, Int -> UpAdptThd -> Int
UpAdptThd -> Int
(Int -> UpAdptThd -> Int)
-> (UpAdptThd -> Int) -> Hashable UpAdptThd
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: UpAdptThd -> Int
$chash :: UpAdptThd -> Int
hashWithSalt :: Int -> UpAdptThd -> Int
$chashWithSalt :: Int -> UpAdptThd -> Int
Hashable, Integer -> UpAdptThd
UpAdptThd -> UpAdptThd
UpAdptThd -> UpAdptThd -> UpAdptThd
(UpAdptThd -> UpAdptThd -> UpAdptThd)
-> (UpAdptThd -> UpAdptThd -> UpAdptThd)
-> (UpAdptThd -> UpAdptThd -> UpAdptThd)
-> (UpAdptThd -> UpAdptThd)
-> (UpAdptThd -> UpAdptThd)
-> (UpAdptThd -> UpAdptThd)
-> (Integer -> UpAdptThd)
-> Num UpAdptThd
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> UpAdptThd
$cfromInteger :: Integer -> UpAdptThd
signum :: UpAdptThd -> UpAdptThd
$csignum :: UpAdptThd -> UpAdptThd
abs :: UpAdptThd -> UpAdptThd
$cabs :: UpAdptThd -> UpAdptThd
negate :: UpAdptThd -> UpAdptThd
$cnegate :: UpAdptThd -> UpAdptThd
* :: UpAdptThd -> UpAdptThd -> UpAdptThd
$c* :: UpAdptThd -> UpAdptThd -> UpAdptThd
- :: UpAdptThd -> UpAdptThd -> UpAdptThd
$c- :: UpAdptThd -> UpAdptThd -> UpAdptThd
+ :: UpAdptThd -> UpAdptThd -> UpAdptThd
$c+ :: UpAdptThd -> UpAdptThd -> UpAdptThd
Num, Num UpAdptThd
Ord UpAdptThd
Num UpAdptThd
-> Ord UpAdptThd -> (UpAdptThd -> Rational) -> Real UpAdptThd
UpAdptThd -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: UpAdptThd -> Rational
$ctoRational :: UpAdptThd -> Rational
$cp2Real :: Ord UpAdptThd
$cp1Real :: Num UpAdptThd
Real, Num UpAdptThd
Num UpAdptThd
-> (UpAdptThd -> UpAdptThd -> UpAdptThd)
-> (UpAdptThd -> UpAdptThd)
-> (Rational -> UpAdptThd)
-> Fractional UpAdptThd
Rational -> UpAdptThd
UpAdptThd -> UpAdptThd
UpAdptThd -> UpAdptThd -> UpAdptThd
forall a.
Num a
-> (a -> a -> a) -> (a -> a) -> (Rational -> a) -> Fractional a
fromRational :: Rational -> UpAdptThd
$cfromRational :: Rational -> UpAdptThd
recip :: UpAdptThd -> UpAdptThd
$crecip :: UpAdptThd -> UpAdptThd
/ :: UpAdptThd -> UpAdptThd -> UpAdptThd
$c/ :: UpAdptThd -> UpAdptThd -> UpAdptThd
$cp1Fractional :: Num UpAdptThd
Fractional, Fractional UpAdptThd
Real UpAdptThd
Real UpAdptThd
-> Fractional UpAdptThd
-> (forall b. Integral b => UpAdptThd -> (b, UpAdptThd))
-> (forall b. Integral b => UpAdptThd -> b)
-> (forall b. Integral b => UpAdptThd -> b)
-> (forall b. Integral b => UpAdptThd -> b)
-> (forall b. Integral b => UpAdptThd -> b)
-> RealFrac UpAdptThd
UpAdptThd -> b
UpAdptThd -> b
UpAdptThd -> b
UpAdptThd -> b
UpAdptThd -> (b, UpAdptThd)
forall b. Integral b => UpAdptThd -> b
forall b. Integral b => UpAdptThd -> (b, UpAdptThd)
forall a.
Real a
-> Fractional a
-> (forall b. Integral b => a -> (b, a))
-> (forall b. Integral b => a -> b)
-> (forall b. Integral b => a -> b)
-> (forall b. Integral b => a -> b)
-> (forall b. Integral b => a -> b)
-> RealFrac a
floor :: UpAdptThd -> b
$cfloor :: forall b. Integral b => UpAdptThd -> b
ceiling :: UpAdptThd -> b
$cceiling :: forall b. Integral b => UpAdptThd -> b
round :: UpAdptThd -> b
$cround :: forall b. Integral b => UpAdptThd -> b
truncate :: UpAdptThd -> b
$ctruncate :: forall b. Integral b => UpAdptThd -> b
properFraction :: UpAdptThd -> (b, UpAdptThd)
$cproperFraction :: forall b. Integral b => UpAdptThd -> (b, UpAdptThd)
$cp2RealFrac :: Fractional UpAdptThd
$cp1RealFrac :: Real UpAdptThd
RealFrac, Context -> UpAdptThd -> IO (Maybe ThunkInfo)
Proxy UpAdptThd -> String
(Context -> UpAdptThd -> IO (Maybe ThunkInfo))
-> (Context -> UpAdptThd -> IO (Maybe ThunkInfo))
-> (Proxy UpAdptThd -> String)
-> NoThunks UpAdptThd
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy UpAdptThd -> String
$cshowTypeOf :: Proxy UpAdptThd -> String
wNoThunks :: Context -> UpAdptThd -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> UpAdptThd -> IO (Maybe ThunkInfo)
noThunks :: Context -> UpAdptThd -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> UpAdptThd -> IO (Maybe ThunkInfo)
NoThunks)
  deriving anyclass (UpAdptThd -> Seq TypeRep
(UpAdptThd -> Seq TypeRep) -> HasTypeReps UpAdptThd
forall a. (a -> Seq TypeRep) -> HasTypeReps a
typeReps :: UpAdptThd -> Seq TypeRep
$ctypeReps :: UpAdptThd -> Seq TypeRep
HasTypeReps)

newtype BkSgnCntT = BkSgnCntT Double
  deriving stock ((forall x. BkSgnCntT -> Rep BkSgnCntT x)
-> (forall x. Rep BkSgnCntT x -> BkSgnCntT) -> Generic BkSgnCntT
forall x. Rep BkSgnCntT x -> BkSgnCntT
forall x. BkSgnCntT -> Rep BkSgnCntT x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BkSgnCntT x -> BkSgnCntT
$cfrom :: forall x. BkSgnCntT -> Rep BkSgnCntT x
Generic, Int -> BkSgnCntT -> ShowS
[BkSgnCntT] -> ShowS
BkSgnCntT -> String
(Int -> BkSgnCntT -> ShowS)
-> (BkSgnCntT -> String)
-> ([BkSgnCntT] -> ShowS)
-> Show BkSgnCntT
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BkSgnCntT] -> ShowS
$cshowList :: [BkSgnCntT] -> ShowS
show :: BkSgnCntT -> String
$cshow :: BkSgnCntT -> String
showsPrec :: Int -> BkSgnCntT -> ShowS
$cshowsPrec :: Int -> BkSgnCntT -> ShowS
Show, Typeable BkSgnCntT
DataType
Constr
Typeable BkSgnCntT
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> BkSgnCntT -> c BkSgnCntT)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c BkSgnCntT)
-> (BkSgnCntT -> Constr)
-> (BkSgnCntT -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c BkSgnCntT))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BkSgnCntT))
-> ((forall b. Data b => b -> b) -> BkSgnCntT -> BkSgnCntT)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> BkSgnCntT -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> BkSgnCntT -> r)
-> (forall u. (forall d. Data d => d -> u) -> BkSgnCntT -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> BkSgnCntT -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> BkSgnCntT -> m BkSgnCntT)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> BkSgnCntT -> m BkSgnCntT)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> BkSgnCntT -> m BkSgnCntT)
-> Data BkSgnCntT
BkSgnCntT -> DataType
BkSgnCntT -> Constr
(forall b. Data b => b -> b) -> BkSgnCntT -> BkSgnCntT
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BkSgnCntT -> c BkSgnCntT
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BkSgnCntT
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> BkSgnCntT -> u
forall u. (forall d. Data d => d -> u) -> BkSgnCntT -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BkSgnCntT -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BkSgnCntT -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BkSgnCntT -> m BkSgnCntT
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BkSgnCntT -> m BkSgnCntT
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BkSgnCntT
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BkSgnCntT -> c BkSgnCntT
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BkSgnCntT)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BkSgnCntT)
$cBkSgnCntT :: Constr
$tBkSgnCntT :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> BkSgnCntT -> m BkSgnCntT
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BkSgnCntT -> m BkSgnCntT
gmapMp :: (forall d. Data d => d -> m d) -> BkSgnCntT -> m BkSgnCntT
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BkSgnCntT -> m BkSgnCntT
gmapM :: (forall d. Data d => d -> m d) -> BkSgnCntT -> m BkSgnCntT
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BkSgnCntT -> m BkSgnCntT
gmapQi :: Int -> (forall d. Data d => d -> u) -> BkSgnCntT -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BkSgnCntT -> u
gmapQ :: (forall d. Data d => d -> u) -> BkSgnCntT -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BkSgnCntT -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BkSgnCntT -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BkSgnCntT -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BkSgnCntT -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BkSgnCntT -> r
gmapT :: (forall b. Data b => b -> b) -> BkSgnCntT -> BkSgnCntT
$cgmapT :: (forall b. Data b => b -> b) -> BkSgnCntT -> BkSgnCntT
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BkSgnCntT)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BkSgnCntT)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c BkSgnCntT)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BkSgnCntT)
dataTypeOf :: BkSgnCntT -> DataType
$cdataTypeOf :: BkSgnCntT -> DataType
toConstr :: BkSgnCntT -> Constr
$ctoConstr :: BkSgnCntT -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BkSgnCntT
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BkSgnCntT
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BkSgnCntT -> c BkSgnCntT
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BkSgnCntT -> c BkSgnCntT
$cp1Data :: Typeable BkSgnCntT
Data, Typeable)
  deriving newtype (BkSgnCntT -> BkSgnCntT -> Bool
(BkSgnCntT -> BkSgnCntT -> Bool)
-> (BkSgnCntT -> BkSgnCntT -> Bool) -> Eq BkSgnCntT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BkSgnCntT -> BkSgnCntT -> Bool
$c/= :: BkSgnCntT -> BkSgnCntT -> Bool
== :: BkSgnCntT -> BkSgnCntT -> Bool
$c== :: BkSgnCntT -> BkSgnCntT -> Bool
Eq, Eq BkSgnCntT
Eq BkSgnCntT
-> (BkSgnCntT -> BkSgnCntT -> Ordering)
-> (BkSgnCntT -> BkSgnCntT -> Bool)
-> (BkSgnCntT -> BkSgnCntT -> Bool)
-> (BkSgnCntT -> BkSgnCntT -> Bool)
-> (BkSgnCntT -> BkSgnCntT -> Bool)
-> (BkSgnCntT -> BkSgnCntT -> BkSgnCntT)
-> (BkSgnCntT -> BkSgnCntT -> BkSgnCntT)
-> Ord BkSgnCntT
BkSgnCntT -> BkSgnCntT -> Bool
BkSgnCntT -> BkSgnCntT -> Ordering
BkSgnCntT -> BkSgnCntT -> BkSgnCntT
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
min :: BkSgnCntT -> BkSgnCntT -> BkSgnCntT
$cmin :: BkSgnCntT -> BkSgnCntT -> BkSgnCntT
max :: BkSgnCntT -> BkSgnCntT -> BkSgnCntT
$cmax :: BkSgnCntT -> BkSgnCntT -> BkSgnCntT
>= :: BkSgnCntT -> BkSgnCntT -> Bool
$c>= :: BkSgnCntT -> BkSgnCntT -> Bool
> :: BkSgnCntT -> BkSgnCntT -> Bool
$c> :: BkSgnCntT -> BkSgnCntT -> Bool
<= :: BkSgnCntT -> BkSgnCntT -> Bool
$c<= :: BkSgnCntT -> BkSgnCntT -> Bool
< :: BkSgnCntT -> BkSgnCntT -> Bool
$c< :: BkSgnCntT -> BkSgnCntT -> Bool
compare :: BkSgnCntT -> BkSgnCntT -> Ordering
$ccompare :: BkSgnCntT -> BkSgnCntT -> Ordering
$cp1Ord :: Eq BkSgnCntT
Ord, Int -> BkSgnCntT -> Int
BkSgnCntT -> Int
(Int -> BkSgnCntT -> Int)
-> (BkSgnCntT -> Int) -> Hashable BkSgnCntT
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: BkSgnCntT -> Int
$chash :: BkSgnCntT -> Int
hashWithSalt :: Int -> BkSgnCntT -> Int
$chashWithSalt :: Int -> BkSgnCntT -> Int
Hashable, Integer -> BkSgnCntT
BkSgnCntT -> BkSgnCntT
BkSgnCntT -> BkSgnCntT -> BkSgnCntT
(BkSgnCntT -> BkSgnCntT -> BkSgnCntT)
-> (BkSgnCntT -> BkSgnCntT -> BkSgnCntT)
-> (BkSgnCntT -> BkSgnCntT -> BkSgnCntT)
-> (BkSgnCntT -> BkSgnCntT)
-> (BkSgnCntT -> BkSgnCntT)
-> (BkSgnCntT -> BkSgnCntT)
-> (Integer -> BkSgnCntT)
-> Num BkSgnCntT
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> BkSgnCntT
$cfromInteger :: Integer -> BkSgnCntT
signum :: BkSgnCntT -> BkSgnCntT
$csignum :: BkSgnCntT -> BkSgnCntT
abs :: BkSgnCntT -> BkSgnCntT
$cabs :: BkSgnCntT -> BkSgnCntT
negate :: BkSgnCntT -> BkSgnCntT
$cnegate :: BkSgnCntT -> BkSgnCntT
* :: BkSgnCntT -> BkSgnCntT -> BkSgnCntT
$c* :: BkSgnCntT -> BkSgnCntT -> BkSgnCntT
- :: BkSgnCntT -> BkSgnCntT -> BkSgnCntT
$c- :: BkSgnCntT -> BkSgnCntT -> BkSgnCntT
+ :: BkSgnCntT -> BkSgnCntT -> BkSgnCntT
$c+ :: BkSgnCntT -> BkSgnCntT -> BkSgnCntT
Num, Num BkSgnCntT
Num BkSgnCntT
-> (BkSgnCntT -> BkSgnCntT -> BkSgnCntT)
-> (BkSgnCntT -> BkSgnCntT)
-> (Rational -> BkSgnCntT)
-> Fractional BkSgnCntT
Rational -> BkSgnCntT
BkSgnCntT -> BkSgnCntT
BkSgnCntT -> BkSgnCntT -> BkSgnCntT
forall a.
Num a
-> (a -> a -> a) -> (a -> a) -> (Rational -> a) -> Fractional a
fromRational :: Rational -> BkSgnCntT
$cfromRational :: Rational -> BkSgnCntT
recip :: BkSgnCntT -> BkSgnCntT
$crecip :: BkSgnCntT -> BkSgnCntT
/ :: BkSgnCntT -> BkSgnCntT -> BkSgnCntT
$c/ :: BkSgnCntT -> BkSgnCntT -> BkSgnCntT
$cp1Fractional :: Num BkSgnCntT
Fractional, Context -> BkSgnCntT -> IO (Maybe ThunkInfo)
Proxy BkSgnCntT -> String
(Context -> BkSgnCntT -> IO (Maybe ThunkInfo))
-> (Context -> BkSgnCntT -> IO (Maybe ThunkInfo))
-> (Proxy BkSgnCntT -> String)
-> NoThunks BkSgnCntT
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy BkSgnCntT -> String
$cshowTypeOf :: Proxy BkSgnCntT -> String
wNoThunks :: Context -> BkSgnCntT -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> BkSgnCntT -> IO (Maybe ThunkInfo)
noThunks :: Context -> BkSgnCntT -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> BkSgnCntT -> IO (Maybe ThunkInfo)
NoThunks)
  deriving anyclass (BkSgnCntT -> Seq TypeRep
(BkSgnCntT -> Seq TypeRep) -> HasTypeReps BkSgnCntT
forall a. (a -> Seq TypeRep) -> HasTypeReps a
typeReps :: BkSgnCntT -> Seq TypeRep
$ctypeReps :: BkSgnCntT -> Seq TypeRep
HasTypeReps)

-- | Protocol parameters.
--
data PParams = PParams -- TODO: this should be a module of @byron-spec-ledger@.
  { PParams -> Natural
_maxBkSz :: !Natural
  -- ^ Maximum (abstract) block size in words
  , PParams -> Natural
_maxHdrSz :: !Natural
  -- ^ Maximum (abstract) block header size in words
  , PParams -> Natural
_maxTxSz :: !Natural
  -- ^ Maximum (abstract) transaction size in words
  , PParams -> Natural
_maxPropSz :: !Natural
  -- ^ Maximum (abstract) update proposal size in words
  , PParams -> BkSgnCntT
_bkSgnCntT :: !BkSgnCntT
  -- ^ Fraction [0, 1] of the blocks that can be signed by any given key in a
  -- window of lenght '_bkSgnCntW'. This value will be typically between 1/5
  -- and 1/4
  , PParams -> SlotCount
_bkSlotsPerEpoch :: !Core.SlotCount
  -- ^ Number of slots in an epoch.
  -- TODO: this should be removed since the number of slots per epoch should remain constant.
  , PParams -> SlotCount
_upTtl :: !Core.SlotCount
  -- ^ Update proposal TTL in slots
  , PParams -> Natural
_scriptVersion :: !Natural
  -- ^ Script version
  , PParams -> UpAdptThd
_upAdptThd :: !UpAdptThd
  -- ^ Update adoption threshold: a proportion of block issuers that have to
  -- endorse a given version to become candidate for adoption
  , PParams -> FactorA
_factorA :: !FactorA -- TODO: these should have type 'Word64', like in `cardano-ledger`.
  -- ^ Minimum fees per transaction
  , PParams -> FactorB
_factorB :: !FactorB
  -- ^ Additional fees per transaction size
  } deriving (PParams -> PParams -> Bool
(PParams -> PParams -> Bool)
-> (PParams -> PParams -> Bool) -> Eq PParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PParams -> PParams -> Bool
$c/= :: PParams -> PParams -> Bool
== :: PParams -> PParams -> Bool
$c== :: PParams -> PParams -> Bool
Eq, (forall x. PParams -> Rep PParams x)
-> (forall x. Rep PParams x -> PParams) -> Generic PParams
forall x. Rep PParams x -> PParams
forall x. PParams -> Rep PParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PParams x -> PParams
$cfrom :: forall x. PParams -> Rep PParams x
Generic, Eq PParams
Eq PParams
-> (PParams -> PParams -> Ordering)
-> (PParams -> PParams -> Bool)
-> (PParams -> PParams -> Bool)
-> (PParams -> PParams -> Bool)
-> (PParams -> PParams -> Bool)
-> (PParams -> PParams -> PParams)
-> (PParams -> PParams -> PParams)
-> Ord PParams
PParams -> PParams -> Bool
PParams -> PParams -> Ordering
PParams -> PParams -> PParams
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
min :: PParams -> PParams -> PParams
$cmin :: PParams -> PParams -> PParams
max :: PParams -> PParams -> PParams
$cmax :: PParams -> PParams -> PParams
>= :: PParams -> PParams -> Bool
$c>= :: PParams -> PParams -> Bool
> :: PParams -> PParams -> Bool
$c> :: PParams -> PParams -> Bool
<= :: PParams -> PParams -> Bool
$c<= :: PParams -> PParams -> Bool
< :: PParams -> PParams -> Bool
$c< :: PParams -> PParams -> Bool
compare :: PParams -> PParams -> Ordering
$ccompare :: PParams -> PParams -> Ordering
$cp1Ord :: Eq PParams
Ord, Int -> PParams -> ShowS
[PParams] -> ShowS
PParams -> String
(Int -> PParams -> ShowS)
-> (PParams -> String) -> ([PParams] -> ShowS) -> Show PParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PParams] -> ShowS
$cshowList :: [PParams] -> ShowS
show :: PParams -> String
$cshow :: PParams -> String
showsPrec :: Int -> PParams -> ShowS
$cshowsPrec :: Int -> PParams -> ShowS
Show, Int -> PParams -> Int
PParams -> Int
(Int -> PParams -> Int) -> (PParams -> Int) -> Hashable PParams
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: PParams -> Int
$chash :: PParams -> Int
hashWithSalt :: Int -> PParams -> Int
$chashWithSalt :: Int -> PParams -> Int
Hashable, Typeable PParams
DataType
Constr
Typeable PParams
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PParams -> c PParams)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PParams)
-> (PParams -> Constr)
-> (PParams -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PParams))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PParams))
-> ((forall b. Data b => b -> b) -> PParams -> PParams)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PParams -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PParams -> r)
-> (forall u. (forall d. Data d => d -> u) -> PParams -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> PParams -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> PParams -> m PParams)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PParams -> m PParams)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PParams -> m PParams)
-> Data PParams
PParams -> DataType
PParams -> Constr
(forall b. Data b => b -> b) -> PParams -> PParams
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PParams -> c PParams
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PParams
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> PParams -> u
forall u. (forall d. Data d => d -> u) -> PParams -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PParams -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PParams -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> PParams -> m PParams
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PParams -> m PParams
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PParams
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PParams -> c PParams
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PParams)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PParams)
$cPParams :: Constr
$tPParams :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> PParams -> m PParams
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PParams -> m PParams
gmapMp :: (forall d. Data d => d -> m d) -> PParams -> m PParams
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PParams -> m PParams
gmapM :: (forall d. Data d => d -> m d) -> PParams -> m PParams
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> PParams -> m PParams
gmapQi :: Int -> (forall d. Data d => d -> u) -> PParams -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> PParams -> u
gmapQ :: (forall d. Data d => d -> u) -> PParams -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> PParams -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PParams -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PParams -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PParams -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PParams -> r
gmapT :: (forall b. Data b => b -> b) -> PParams -> PParams
$cgmapT :: (forall b. Data b => b -> b) -> PParams -> PParams
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PParams)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PParams)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c PParams)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PParams)
dataTypeOf :: PParams -> DataType
$cdataTypeOf :: PParams -> DataType
toConstr :: PParams -> Constr
$ctoConstr :: PParams -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PParams
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PParams
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PParams -> c PParams
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PParams -> c PParams
$cp1Data :: Typeable PParams
Data, Typeable, Context -> PParams -> IO (Maybe ThunkInfo)
Proxy PParams -> String
(Context -> PParams -> IO (Maybe ThunkInfo))
-> (Context -> PParams -> IO (Maybe ThunkInfo))
-> (Proxy PParams -> String)
-> NoThunks PParams
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy PParams -> String
$cshowTypeOf :: Proxy PParams -> String
wNoThunks :: Context -> PParams -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> PParams -> IO (Maybe ThunkInfo)
noThunks :: Context -> PParams -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> PParams -> IO (Maybe ThunkInfo)
NoThunks)

makeLenses ''PParams

instance HasTypeReps PParams

newtype UpId = UpId Int
  deriving stock ((forall x. UpId -> Rep UpId x)
-> (forall x. Rep UpId x -> UpId) -> Generic UpId
forall x. Rep UpId x -> UpId
forall x. UpId -> Rep UpId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpId x -> UpId
$cfrom :: forall x. UpId -> Rep UpId x
Generic, Int -> UpId -> ShowS
[UpId] -> ShowS
UpId -> String
(Int -> UpId -> ShowS)
-> (UpId -> String) -> ([UpId] -> ShowS) -> Show UpId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpId] -> ShowS
$cshowList :: [UpId] -> ShowS
show :: UpId -> String
$cshow :: UpId -> String
showsPrec :: Int -> UpId -> ShowS
$cshowsPrec :: Int -> UpId -> ShowS
Show, Typeable UpId
DataType
Constr
Typeable UpId
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> UpId -> c UpId)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UpId)
-> (UpId -> Constr)
-> (UpId -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UpId))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UpId))
-> ((forall b. Data b => b -> b) -> UpId -> UpId)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UpId -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UpId -> r)
-> (forall u. (forall d. Data d => d -> u) -> UpId -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> UpId -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> UpId -> m UpId)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UpId -> m UpId)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UpId -> m UpId)
-> Data UpId
UpId -> DataType
UpId -> Constr
(forall b. Data b => b -> b) -> UpId -> UpId
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UpId -> c UpId
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpId
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> UpId -> u
forall u. (forall d. Data d => d -> u) -> UpId -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UpId -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UpId -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UpId -> m UpId
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UpId -> m UpId
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpId
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UpId -> c UpId
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UpId)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UpId)
$cUpId :: Constr
$tUpId :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> UpId -> m UpId
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UpId -> m UpId
gmapMp :: (forall d. Data d => d -> m d) -> UpId -> m UpId
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UpId -> m UpId
gmapM :: (forall d. Data d => d -> m d) -> UpId -> m UpId
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UpId -> m UpId
gmapQi :: Int -> (forall d. Data d => d -> u) -> UpId -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> UpId -> u
gmapQ :: (forall d. Data d => d -> u) -> UpId -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> UpId -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UpId -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UpId -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UpId -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UpId -> r
gmapT :: (forall b. Data b => b -> b) -> UpId -> UpId
$cgmapT :: (forall b. Data b => b -> b) -> UpId -> UpId
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UpId)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UpId)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UpId)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UpId)
dataTypeOf :: UpId -> DataType
$cdataTypeOf :: UpId -> DataType
toConstr :: UpId -> Constr
$ctoConstr :: UpId -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpId
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpId
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UpId -> c UpId
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UpId -> c UpId
$cp1Data :: Typeable UpId
Data, Typeable)
  deriving newtype (UpId -> UpId -> Bool
(UpId -> UpId -> Bool) -> (UpId -> UpId -> Bool) -> Eq UpId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpId -> UpId -> Bool
$c/= :: UpId -> UpId -> Bool
== :: UpId -> UpId -> Bool
$c== :: UpId -> UpId -> Bool
Eq, Eq UpId
Eq UpId
-> (UpId -> UpId -> Ordering)
-> (UpId -> UpId -> Bool)
-> (UpId -> UpId -> Bool)
-> (UpId -> UpId -> Bool)
-> (UpId -> UpId -> Bool)
-> (UpId -> UpId -> UpId)
-> (UpId -> UpId -> UpId)
-> Ord UpId
UpId -> UpId -> Bool
UpId -> UpId -> Ordering
UpId -> UpId -> UpId
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
min :: UpId -> UpId -> UpId
$cmin :: UpId -> UpId -> UpId
max :: UpId -> UpId -> UpId
$cmax :: UpId -> UpId -> UpId
>= :: UpId -> UpId -> Bool
$c>= :: UpId -> UpId -> Bool
> :: UpId -> UpId -> Bool
$c> :: UpId -> UpId -> Bool
<= :: UpId -> UpId -> Bool
$c<= :: UpId -> UpId -> Bool
< :: UpId -> UpId -> Bool
$c< :: UpId -> UpId -> Bool
compare :: UpId -> UpId -> Ordering
$ccompare :: UpId -> UpId -> Ordering
$cp1Ord :: Eq UpId
Ord, Int -> UpId -> Int
UpId -> Int
(Int -> UpId -> Int) -> (UpId -> Int) -> Hashable UpId
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: UpId -> Int
$chash :: UpId -> Int
hashWithSalt :: Int -> UpId -> Int
$chashWithSalt :: Int -> UpId -> Int
Hashable, Context -> UpId -> IO (Maybe ThunkInfo)
Proxy UpId -> String
(Context -> UpId -> IO (Maybe ThunkInfo))
-> (Context -> UpId -> IO (Maybe ThunkInfo))
-> (Proxy UpId -> String)
-> NoThunks UpId
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy UpId -> String
$cshowTypeOf :: Proxy UpId -> String
wNoThunks :: Context -> UpId -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> UpId -> IO (Maybe ThunkInfo)
noThunks :: Context -> UpId -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> UpId -> IO (Maybe ThunkInfo)
NoThunks)
  deriving anyclass (UpId -> Seq TypeRep
(UpId -> Seq TypeRep) -> HasTypeReps UpId
forall a. (a -> Seq TypeRep) -> HasTypeReps a
typeReps :: UpId -> Seq TypeRep
$ctypeReps :: UpId -> Seq TypeRep
HasTypeReps)

-- | Protocol version
data ProtVer = ProtVer
  { ProtVer -> Natural
_pvMaj :: Natural
  , ProtVer -> Natural
_pvMin :: Natural
  , ProtVer -> Natural
_pvAlt :: Natural
  } deriving (ProtVer -> ProtVer -> Bool
(ProtVer -> ProtVer -> Bool)
-> (ProtVer -> ProtVer -> Bool) -> Eq ProtVer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProtVer -> ProtVer -> Bool
$c/= :: ProtVer -> ProtVer -> Bool
== :: ProtVer -> ProtVer -> Bool
$c== :: ProtVer -> ProtVer -> Bool
Eq, (forall x. ProtVer -> Rep ProtVer x)
-> (forall x. Rep ProtVer x -> ProtVer) -> Generic ProtVer
forall x. Rep ProtVer x -> ProtVer
forall x. ProtVer -> Rep ProtVer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProtVer x -> ProtVer
$cfrom :: forall x. ProtVer -> Rep ProtVer x
Generic, Eq ProtVer
Eq ProtVer
-> (ProtVer -> ProtVer -> Ordering)
-> (ProtVer -> ProtVer -> Bool)
-> (ProtVer -> ProtVer -> Bool)
-> (ProtVer -> ProtVer -> Bool)
-> (ProtVer -> ProtVer -> Bool)
-> (ProtVer -> ProtVer -> ProtVer)
-> (ProtVer -> ProtVer -> ProtVer)
-> Ord ProtVer
ProtVer -> ProtVer -> Bool
ProtVer -> ProtVer -> Ordering
ProtVer -> ProtVer -> ProtVer
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
min :: ProtVer -> ProtVer -> ProtVer
$cmin :: ProtVer -> ProtVer -> ProtVer
max :: ProtVer -> ProtVer -> ProtVer
$cmax :: ProtVer -> ProtVer -> ProtVer
>= :: ProtVer -> ProtVer -> Bool
$c>= :: ProtVer -> ProtVer -> Bool
> :: ProtVer -> ProtVer -> Bool
$c> :: ProtVer -> ProtVer -> Bool
<= :: ProtVer -> ProtVer -> Bool
$c<= :: ProtVer -> ProtVer -> Bool
< :: ProtVer -> ProtVer -> Bool
$c< :: ProtVer -> ProtVer -> Bool
compare :: ProtVer -> ProtVer -> Ordering
$ccompare :: ProtVer -> ProtVer -> Ordering
$cp1Ord :: Eq ProtVer
Ord, Int -> ProtVer -> ShowS
[ProtVer] -> ShowS
ProtVer -> String
(Int -> ProtVer -> ShowS)
-> (ProtVer -> String) -> ([ProtVer] -> ShowS) -> Show ProtVer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProtVer] -> ShowS
$cshowList :: [ProtVer] -> ShowS
show :: ProtVer -> String
$cshow :: ProtVer -> String
showsPrec :: Int -> ProtVer -> ShowS
$cshowsPrec :: Int -> ProtVer -> ShowS
Show, Int -> ProtVer -> Int
ProtVer -> Int
(Int -> ProtVer -> Int) -> (ProtVer -> Int) -> Hashable ProtVer
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: ProtVer -> Int
$chash :: ProtVer -> Int
hashWithSalt :: Int -> ProtVer -> Int
$chashWithSalt :: Int -> ProtVer -> Int
Hashable, Typeable ProtVer
DataType
Constr
Typeable ProtVer
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ProtVer -> c ProtVer)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ProtVer)
-> (ProtVer -> Constr)
-> (ProtVer -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ProtVer))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProtVer))
-> ((forall b. Data b => b -> b) -> ProtVer -> ProtVer)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ProtVer -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ProtVer -> r)
-> (forall u. (forall d. Data d => d -> u) -> ProtVer -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> ProtVer -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> ProtVer -> m ProtVer)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ProtVer -> m ProtVer)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ProtVer -> m ProtVer)
-> Data ProtVer
ProtVer -> DataType
ProtVer -> Constr
(forall b. Data b => b -> b) -> ProtVer -> ProtVer
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProtVer -> c ProtVer
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ProtVer
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ProtVer -> u
forall u. (forall d. Data d => d -> u) -> ProtVer -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ProtVer -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ProtVer -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ProtVer -> m ProtVer
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ProtVer -> m ProtVer
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ProtVer
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProtVer -> c ProtVer
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ProtVer)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProtVer)
$cProtVer :: Constr
$tProtVer :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> ProtVer -> m ProtVer
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ProtVer -> m ProtVer
gmapMp :: (forall d. Data d => d -> m d) -> ProtVer -> m ProtVer
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ProtVer -> m ProtVer
gmapM :: (forall d. Data d => d -> m d) -> ProtVer -> m ProtVer
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ProtVer -> m ProtVer
gmapQi :: Int -> (forall d. Data d => d -> u) -> ProtVer -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ProtVer -> u
gmapQ :: (forall d. Data d => d -> u) -> ProtVer -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ProtVer -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ProtVer -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ProtVer -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ProtVer -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ProtVer -> r
gmapT :: (forall b. Data b => b -> b) -> ProtVer -> ProtVer
$cgmapT :: (forall b. Data b => b -> b) -> ProtVer -> ProtVer
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProtVer)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProtVer)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ProtVer)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ProtVer)
dataTypeOf :: ProtVer -> DataType
$cdataTypeOf :: ProtVer -> DataType
toConstr :: ProtVer -> Constr
$ctoConstr :: ProtVer -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ProtVer
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ProtVer
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProtVer -> c ProtVer
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ProtVer -> c ProtVer
$cp1Data :: Typeable ProtVer
Data, Typeable, Context -> ProtVer -> IO (Maybe ThunkInfo)
Proxy ProtVer -> String
(Context -> ProtVer -> IO (Maybe ThunkInfo))
-> (Context -> ProtVer -> IO (Maybe ThunkInfo))
-> (Proxy ProtVer -> String)
-> NoThunks ProtVer
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy ProtVer -> String
$cshowTypeOf :: Proxy ProtVer -> String
wNoThunks :: Context -> ProtVer -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> ProtVer -> IO (Maybe ThunkInfo)
noThunks :: Context -> ProtVer -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> ProtVer -> IO (Maybe ThunkInfo)
NoThunks)

makeLenses ''ProtVer

instance HasTypeReps ProtVer

newtype ApName = ApName String
  deriving stock ((forall x. ApName -> Rep ApName x)
-> (forall x. Rep ApName x -> ApName) -> Generic ApName
forall x. Rep ApName x -> ApName
forall x. ApName -> Rep ApName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApName x -> ApName
$cfrom :: forall x. ApName -> Rep ApName x
Generic, Int -> ApName -> ShowS
[ApName] -> ShowS
ApName -> String
(Int -> ApName -> ShowS)
-> (ApName -> String) -> ([ApName] -> ShowS) -> Show ApName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApName] -> ShowS
$cshowList :: [ApName] -> ShowS
show :: ApName -> String
$cshow :: ApName -> String
showsPrec :: Int -> ApName -> ShowS
$cshowsPrec :: Int -> ApName -> ShowS
Show, Typeable ApName
DataType
Constr
Typeable ApName
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ApName -> c ApName)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ApName)
-> (ApName -> Constr)
-> (ApName -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ApName))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ApName))
-> ((forall b. Data b => b -> b) -> ApName -> ApName)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ApName -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ApName -> r)
-> (forall u. (forall d. Data d => d -> u) -> ApName -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> ApName -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> ApName -> m ApName)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ApName -> m ApName)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ApName -> m ApName)
-> Data ApName
ApName -> DataType
ApName -> Constr
(forall b. Data b => b -> b) -> ApName -> ApName
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ApName -> c ApName
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ApName
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ApName -> u
forall u. (forall d. Data d => d -> u) -> ApName -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ApName -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ApName -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ApName -> m ApName
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ApName -> m ApName
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ApName
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ApName -> c ApName
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ApName)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ApName)
$cApName :: Constr
$tApName :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> ApName -> m ApName
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ApName -> m ApName
gmapMp :: (forall d. Data d => d -> m d) -> ApName -> m ApName
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ApName -> m ApName
gmapM :: (forall d. Data d => d -> m d) -> ApName -> m ApName
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ApName -> m ApName
gmapQi :: Int -> (forall d. Data d => d -> u) -> ApName -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ApName -> u
gmapQ :: (forall d. Data d => d -> u) -> ApName -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ApName -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ApName -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ApName -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ApName -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ApName -> r
gmapT :: (forall b. Data b => b -> b) -> ApName -> ApName
$cgmapT :: (forall b. Data b => b -> b) -> ApName -> ApName
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ApName)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ApName)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ApName)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ApName)
dataTypeOf :: ApName -> DataType
$cdataTypeOf :: ApName -> DataType
toConstr :: ApName -> Constr
$ctoConstr :: ApName -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ApName
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ApName
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ApName -> c ApName
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ApName -> c ApName
$cp1Data :: Typeable ApName
Data, Typeable)
  deriving newtype (ApName -> ApName -> Bool
(ApName -> ApName -> Bool)
-> (ApName -> ApName -> Bool) -> Eq ApName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApName -> ApName -> Bool
$c/= :: ApName -> ApName -> Bool
== :: ApName -> ApName -> Bool
$c== :: ApName -> ApName -> Bool
Eq, Eq ApName
Eq ApName
-> (ApName -> ApName -> Ordering)
-> (ApName -> ApName -> Bool)
-> (ApName -> ApName -> Bool)
-> (ApName -> ApName -> Bool)
-> (ApName -> ApName -> Bool)
-> (ApName -> ApName -> ApName)
-> (ApName -> ApName -> ApName)
-> Ord ApName
ApName -> ApName -> Bool
ApName -> ApName -> Ordering
ApName -> ApName -> ApName
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
min :: ApName -> ApName -> ApName
$cmin :: ApName -> ApName -> ApName
max :: ApName -> ApName -> ApName
$cmax :: ApName -> ApName -> ApName
>= :: ApName -> ApName -> Bool
$c>= :: ApName -> ApName -> Bool
> :: ApName -> ApName -> Bool
$c> :: ApName -> ApName -> Bool
<= :: ApName -> ApName -> Bool
$c<= :: ApName -> ApName -> Bool
< :: ApName -> ApName -> Bool
$c< :: ApName -> ApName -> Bool
compare :: ApName -> ApName -> Ordering
$ccompare :: ApName -> ApName -> Ordering
$cp1Ord :: Eq ApName
Ord, Int -> ApName -> Int
ApName -> Int
(Int -> ApName -> Int) -> (ApName -> Int) -> Hashable ApName
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: ApName -> Int
$chash :: ApName -> Int
hashWithSalt :: Int -> ApName -> Int
$chashWithSalt :: Int -> ApName -> Int
Hashable, Context -> ApName -> IO (Maybe ThunkInfo)
Proxy ApName -> String
(Context -> ApName -> IO (Maybe ThunkInfo))
-> (Context -> ApName -> IO (Maybe ThunkInfo))
-> (Proxy ApName -> String)
-> NoThunks ApName
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy ApName -> String
$cshowTypeOf :: Proxy ApName -> String
wNoThunks :: Context -> ApName -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> ApName -> IO (Maybe ThunkInfo)
noThunks :: Context -> ApName -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> ApName -> IO (Maybe ThunkInfo)
NoThunks)

instance HasTypeReps ApName

-- | Application version
newtype ApVer = ApVer Natural
  deriving stock ((forall x. ApVer -> Rep ApVer x)
-> (forall x. Rep ApVer x -> ApVer) -> Generic ApVer
forall x. Rep ApVer x -> ApVer
forall x. ApVer -> Rep ApVer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApVer x -> ApVer
$cfrom :: forall x. ApVer -> Rep ApVer x
Generic, Int -> ApVer -> ShowS
[ApVer] -> ShowS
ApVer -> String
(Int -> ApVer -> ShowS)
-> (ApVer -> String) -> ([ApVer] -> ShowS) -> Show ApVer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApVer] -> ShowS
$cshowList :: [ApVer] -> ShowS
show :: ApVer -> String
$cshow :: ApVer -> String
showsPrec :: Int -> ApVer -> ShowS
$cshowsPrec :: Int -> ApVer -> ShowS
Show, Typeable ApVer
DataType
Constr
Typeable ApVer
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ApVer -> c ApVer)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ApVer)
-> (ApVer -> Constr)
-> (ApVer -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ApVer))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ApVer))
-> ((forall b. Data b => b -> b) -> ApVer -> ApVer)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ApVer -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ApVer -> r)
-> (forall u. (forall d. Data d => d -> u) -> ApVer -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> ApVer -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> ApVer -> m ApVer)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ApVer -> m ApVer)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ApVer -> m ApVer)
-> Data ApVer
ApVer -> DataType
ApVer -> Constr
(forall b. Data b => b -> b) -> ApVer -> ApVer
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ApVer -> c ApVer
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ApVer
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ApVer -> u
forall u. (forall d. Data d => d -> u) -> ApVer -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ApVer -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ApVer -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ApVer -> m ApVer
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ApVer -> m ApVer
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ApVer
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ApVer -> c ApVer
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ApVer)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ApVer)
$cApVer :: Constr
$tApVer :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> ApVer -> m ApVer
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ApVer -> m ApVer
gmapMp :: (forall d. Data d => d -> m d) -> ApVer -> m ApVer
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ApVer -> m ApVer
gmapM :: (forall d. Data d => d -> m d) -> ApVer -> m ApVer
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ApVer -> m ApVer
gmapQi :: Int -> (forall d. Data d => d -> u) -> ApVer -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ApVer -> u
gmapQ :: (forall d. Data d => d -> u) -> ApVer -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ApVer -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ApVer -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ApVer -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ApVer -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ApVer -> r
gmapT :: (forall b. Data b => b -> b) -> ApVer -> ApVer
$cgmapT :: (forall b. Data b => b -> b) -> ApVer -> ApVer
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ApVer)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ApVer)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ApVer)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ApVer)
dataTypeOf :: ApVer -> DataType
$cdataTypeOf :: ApVer -> DataType
toConstr :: ApVer -> Constr
$ctoConstr :: ApVer -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ApVer
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ApVer
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ApVer -> c ApVer
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ApVer -> c ApVer
$cp1Data :: Typeable ApVer
Data, Typeable)
  deriving newtype (ApVer -> ApVer -> Bool
(ApVer -> ApVer -> Bool) -> (ApVer -> ApVer -> Bool) -> Eq ApVer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApVer -> ApVer -> Bool
$c/= :: ApVer -> ApVer -> Bool
== :: ApVer -> ApVer -> Bool
$c== :: ApVer -> ApVer -> Bool
Eq, Eq ApVer
Eq ApVer
-> (ApVer -> ApVer -> Ordering)
-> (ApVer -> ApVer -> Bool)
-> (ApVer -> ApVer -> Bool)
-> (ApVer -> ApVer -> Bool)
-> (ApVer -> ApVer -> Bool)
-> (ApVer -> ApVer -> ApVer)
-> (ApVer -> ApVer -> ApVer)
-> Ord ApVer
ApVer -> ApVer -> Bool
ApVer -> ApVer -> Ordering
ApVer -> ApVer -> ApVer
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
min :: ApVer -> ApVer -> ApVer
$cmin :: ApVer -> ApVer -> ApVer
max :: ApVer -> ApVer -> ApVer
$cmax :: ApVer -> ApVer -> ApVer
>= :: ApVer -> ApVer -> Bool
$c>= :: ApVer -> ApVer -> Bool
> :: ApVer -> ApVer -> Bool
$c> :: ApVer -> ApVer -> Bool
<= :: ApVer -> ApVer -> Bool
$c<= :: ApVer -> ApVer -> Bool
< :: ApVer -> ApVer -> Bool
$c< :: ApVer -> ApVer -> Bool
compare :: ApVer -> ApVer -> Ordering
$ccompare :: ApVer -> ApVer -> Ordering
$cp1Ord :: Eq ApVer
Ord, Integer -> ApVer
ApVer -> ApVer
ApVer -> ApVer -> ApVer
(ApVer -> ApVer -> ApVer)
-> (ApVer -> ApVer -> ApVer)
-> (ApVer -> ApVer -> ApVer)
-> (ApVer -> ApVer)
-> (ApVer -> ApVer)
-> (ApVer -> ApVer)
-> (Integer -> ApVer)
-> Num ApVer
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> ApVer
$cfromInteger :: Integer -> ApVer
signum :: ApVer -> ApVer
$csignum :: ApVer -> ApVer
abs :: ApVer -> ApVer
$cabs :: ApVer -> ApVer
negate :: ApVer -> ApVer
$cnegate :: ApVer -> ApVer
* :: ApVer -> ApVer -> ApVer
$c* :: ApVer -> ApVer -> ApVer
- :: ApVer -> ApVer -> ApVer
$c- :: ApVer -> ApVer -> ApVer
+ :: ApVer -> ApVer -> ApVer
$c+ :: ApVer -> ApVer -> ApVer
Num, Int -> ApVer -> Int
ApVer -> Int
(Int -> ApVer -> Int) -> (ApVer -> Int) -> Hashable ApVer
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: ApVer -> Int
$chash :: ApVer -> Int
hashWithSalt :: Int -> ApVer -> Int
$chashWithSalt :: Int -> ApVer -> Int
Hashable, Context -> ApVer -> IO (Maybe ThunkInfo)
Proxy ApVer -> String
(Context -> ApVer -> IO (Maybe ThunkInfo))
-> (Context -> ApVer -> IO (Maybe ThunkInfo))
-> (Proxy ApVer -> String)
-> NoThunks ApVer
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy ApVer -> String
$cshowTypeOf :: Proxy ApVer -> String
wNoThunks :: Context -> ApVer -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> ApVer -> IO (Maybe ThunkInfo)
noThunks :: Context -> ApVer -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> ApVer -> IO (Maybe ThunkInfo)
NoThunks)

instance HasTypeReps ApVer

data SwVer = SwVer
  { SwVer -> ApName
_svName :: ApName
  , SwVer -> ApVer
_svVer :: ApVer
  } deriving (SwVer -> SwVer -> Bool
(SwVer -> SwVer -> Bool) -> (SwVer -> SwVer -> Bool) -> Eq SwVer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SwVer -> SwVer -> Bool
$c/= :: SwVer -> SwVer -> Bool
== :: SwVer -> SwVer -> Bool
$c== :: SwVer -> SwVer -> Bool
Eq, (forall x. SwVer -> Rep SwVer x)
-> (forall x. Rep SwVer x -> SwVer) -> Generic SwVer
forall x. Rep SwVer x -> SwVer
forall x. SwVer -> Rep SwVer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SwVer x -> SwVer
$cfrom :: forall x. SwVer -> Rep SwVer x
Generic, Int -> SwVer -> ShowS
[SwVer] -> ShowS
SwVer -> String
(Int -> SwVer -> ShowS)
-> (SwVer -> String) -> ([SwVer] -> ShowS) -> Show SwVer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SwVer] -> ShowS
$cshowList :: [SwVer] -> ShowS
show :: SwVer -> String
$cshow :: SwVer -> String
showsPrec :: Int -> SwVer -> ShowS
$cshowsPrec :: Int -> SwVer -> ShowS
Show, Int -> SwVer -> Int
SwVer -> Int
(Int -> SwVer -> Int) -> (SwVer -> Int) -> Hashable SwVer
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: SwVer -> Int
$chash :: SwVer -> Int
hashWithSalt :: Int -> SwVer -> Int
$chashWithSalt :: Int -> SwVer -> Int
Hashable, Typeable SwVer
DataType
Constr
Typeable SwVer
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> SwVer -> c SwVer)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SwVer)
-> (SwVer -> Constr)
-> (SwVer -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SwVer))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SwVer))
-> ((forall b. Data b => b -> b) -> SwVer -> SwVer)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SwVer -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SwVer -> r)
-> (forall u. (forall d. Data d => d -> u) -> SwVer -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> SwVer -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> SwVer -> m SwVer)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SwVer -> m SwVer)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> SwVer -> m SwVer)
-> Data SwVer
SwVer -> DataType
SwVer -> Constr
(forall b. Data b => b -> b) -> SwVer -> SwVer
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SwVer -> c SwVer
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SwVer
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> SwVer -> u
forall u. (forall d. Data d => d -> u) -> SwVer -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SwVer -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SwVer -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SwVer -> m SwVer
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SwVer -> m SwVer
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SwVer
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SwVer -> c SwVer
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SwVer)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SwVer)
$cSwVer :: Constr
$tSwVer :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> SwVer -> m SwVer
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SwVer -> m SwVer
gmapMp :: (forall d. Data d => d -> m d) -> SwVer -> m SwVer
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SwVer -> m SwVer
gmapM :: (forall d. Data d => d -> m d) -> SwVer -> m SwVer
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SwVer -> m SwVer
gmapQi :: Int -> (forall d. Data d => d -> u) -> SwVer -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SwVer -> u
gmapQ :: (forall d. Data d => d -> u) -> SwVer -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> SwVer -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SwVer -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SwVer -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SwVer -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SwVer -> r
gmapT :: (forall b. Data b => b -> b) -> SwVer -> SwVer
$cgmapT :: (forall b. Data b => b -> b) -> SwVer -> SwVer
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SwVer)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SwVer)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c SwVer)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SwVer)
dataTypeOf :: SwVer -> DataType
$cdataTypeOf :: SwVer -> DataType
toConstr :: SwVer -> Constr
$ctoConstr :: SwVer -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SwVer
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SwVer
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SwVer -> c SwVer
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SwVer -> c SwVer
$cp1Data :: Typeable SwVer
Data, Typeable, Context -> SwVer -> IO (Maybe ThunkInfo)
Proxy SwVer -> String
(Context -> SwVer -> IO (Maybe ThunkInfo))
-> (Context -> SwVer -> IO (Maybe ThunkInfo))
-> (Proxy SwVer -> String)
-> NoThunks SwVer
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy SwVer -> String
$cshowTypeOf :: Proxy SwVer -> String
wNoThunks :: Context -> SwVer -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> SwVer -> IO (Maybe ThunkInfo)
noThunks :: Context -> SwVer -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> SwVer -> IO (Maybe ThunkInfo)
NoThunks)

makeLenses ''SwVer

instance HasTypeReps SwVer

-- | Part of the update proposal which must be signed
--
type UpSD =
  ( ProtVer
  , PParams
  , SwVer
  , Set STag
  , Metadata
  )

-- | System tag, this represents a target operating system for the update (e.g.
-- @linux@, @win64@, or @mac32@).
type STag = String

-- | For now we do not have any requirements on metadata.
data Metadata = Metadata
  deriving (Metadata -> Metadata -> Bool
(Metadata -> Metadata -> Bool)
-> (Metadata -> Metadata -> Bool) -> Eq Metadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Metadata -> Metadata -> Bool
$c/= :: Metadata -> Metadata -> Bool
== :: Metadata -> Metadata -> Bool
$c== :: Metadata -> Metadata -> Bool
Eq, Eq Metadata
Eq Metadata
-> (Metadata -> Metadata -> Ordering)
-> (Metadata -> Metadata -> Bool)
-> (Metadata -> Metadata -> Bool)
-> (Metadata -> Metadata -> Bool)
-> (Metadata -> Metadata -> Bool)
-> (Metadata -> Metadata -> Metadata)
-> (Metadata -> Metadata -> Metadata)
-> Ord Metadata
Metadata -> Metadata -> Bool
Metadata -> Metadata -> Ordering
Metadata -> Metadata -> Metadata
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
min :: Metadata -> Metadata -> Metadata
$cmin :: Metadata -> Metadata -> Metadata
max :: Metadata -> Metadata -> Metadata
$cmax :: Metadata -> Metadata -> Metadata
>= :: Metadata -> Metadata -> Bool
$c>= :: Metadata -> Metadata -> Bool
> :: Metadata -> Metadata -> Bool
$c> :: Metadata -> Metadata -> Bool
<= :: Metadata -> Metadata -> Bool
$c<= :: Metadata -> Metadata -> Bool
< :: Metadata -> Metadata -> Bool
$c< :: Metadata -> Metadata -> Bool
compare :: Metadata -> Metadata -> Ordering
$ccompare :: Metadata -> Metadata -> Ordering
$cp1Ord :: Eq Metadata
Ord, Int -> Metadata -> ShowS
[Metadata] -> ShowS
Metadata -> String
(Int -> Metadata -> ShowS)
-> (Metadata -> String) -> ([Metadata] -> ShowS) -> Show Metadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Metadata] -> ShowS
$cshowList :: [Metadata] -> ShowS
show :: Metadata -> String
$cshow :: Metadata -> String
showsPrec :: Int -> Metadata -> ShowS
$cshowsPrec :: Int -> Metadata -> ShowS
Show, (forall x. Metadata -> Rep Metadata x)
-> (forall x. Rep Metadata x -> Metadata) -> Generic Metadata
forall x. Rep Metadata x -> Metadata
forall x. Metadata -> Rep Metadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Metadata x -> Metadata
$cfrom :: forall x. Metadata -> Rep Metadata x
Generic, Int -> Metadata -> Int
Metadata -> Int
(Int -> Metadata -> Int) -> (Metadata -> Int) -> Hashable Metadata
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: Metadata -> Int
$chash :: Metadata -> Int
hashWithSalt :: Int -> Metadata -> Int
$chashWithSalt :: Int -> Metadata -> Int
Hashable, Typeable Metadata
DataType
Constr
Typeable Metadata
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Metadata -> c Metadata)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Metadata)
-> (Metadata -> Constr)
-> (Metadata -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Metadata))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Metadata))
-> ((forall b. Data b => b -> b) -> Metadata -> Metadata)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Metadata -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Metadata -> r)
-> (forall u. (forall d. Data d => d -> u) -> Metadata -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Metadata -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Metadata -> m Metadata)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Metadata -> m Metadata)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Metadata -> m Metadata)
-> Data Metadata
Metadata -> DataType
Metadata -> Constr
(forall b. Data b => b -> b) -> Metadata -> Metadata
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Metadata -> c Metadata
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Metadata
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Metadata -> u
forall u. (forall d. Data d => d -> u) -> Metadata -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Metadata -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Metadata -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Metadata -> m Metadata
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Metadata -> m Metadata
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Metadata
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Metadata -> c Metadata
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Metadata)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Metadata)
$cMetadata :: Constr
$tMetadata :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Metadata -> m Metadata
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Metadata -> m Metadata
gmapMp :: (forall d. Data d => d -> m d) -> Metadata -> m Metadata
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Metadata -> m Metadata
gmapM :: (forall d. Data d => d -> m d) -> Metadata -> m Metadata
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Metadata -> m Metadata
gmapQi :: Int -> (forall d. Data d => d -> u) -> Metadata -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Metadata -> u
gmapQ :: (forall d. Data d => d -> u) -> Metadata -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Metadata -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Metadata -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Metadata -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Metadata -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Metadata -> r
gmapT :: (forall b. Data b => b -> b) -> Metadata -> Metadata
$cgmapT :: (forall b. Data b => b -> b) -> Metadata -> Metadata
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Metadata)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Metadata)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Metadata)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Metadata)
dataTypeOf :: Metadata -> DataType
$cdataTypeOf :: Metadata -> DataType
toConstr :: Metadata -> Constr
$ctoConstr :: Metadata -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Metadata
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Metadata
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Metadata -> c Metadata
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Metadata -> c Metadata
$cp1Data :: Typeable Metadata
Data, Typeable, Context -> Metadata -> IO (Maybe ThunkInfo)
Proxy Metadata -> String
(Context -> Metadata -> IO (Maybe ThunkInfo))
-> (Context -> Metadata -> IO (Maybe ThunkInfo))
-> (Proxy Metadata -> String)
-> NoThunks Metadata
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy Metadata -> String
$cshowTypeOf :: Proxy Metadata -> String
wNoThunks :: Context -> Metadata -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> Metadata -> IO (Maybe ThunkInfo)
noThunks :: Context -> Metadata -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> Metadata -> IO (Maybe ThunkInfo)
NoThunks)

-- | Update proposal
data UProp = UProp
  { UProp -> UpId
_upId :: UpId
  , UProp -> VKey
_upIssuer :: Core.VKey
  , UProp -> PParams
_upParams :: PParams
  , UProp -> ProtVer
_upPV :: ProtVer
  , UProp -> SwVer
_upSwVer :: SwVer
  , UProp -> Sig UpSD
_upSig :: Core.Sig UpSD
  , UProp -> Set String
_upSTags :: Set STag
  -- ^ System tags involved in the update proposal.
  , UProp -> Metadata
_upMdt :: Metadata
  -- ^ Metadata required for performing software updates.
  } deriving (UProp -> UProp -> Bool
(UProp -> UProp -> Bool) -> (UProp -> UProp -> Bool) -> Eq UProp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UProp -> UProp -> Bool
$c/= :: UProp -> UProp -> Bool
== :: UProp -> UProp -> Bool
$c== :: UProp -> UProp -> Bool
Eq, (forall x. UProp -> Rep UProp x)
-> (forall x. Rep UProp x -> UProp) -> Generic UProp
forall x. Rep UProp x -> UProp
forall x. UProp -> Rep UProp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UProp x -> UProp
$cfrom :: forall x. UProp -> Rep UProp x
Generic, Int -> UProp -> ShowS
[UProp] -> ShowS
UProp -> String
(Int -> UProp -> ShowS)
-> (UProp -> String) -> ([UProp] -> ShowS) -> Show UProp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UProp] -> ShowS
$cshowList :: [UProp] -> ShowS
show :: UProp -> String
$cshow :: UProp -> String
showsPrec :: Int -> UProp -> ShowS
$cshowsPrec :: Int -> UProp -> ShowS
Show, Int -> UProp -> Int
UProp -> Int
(Int -> UProp -> Int) -> (UProp -> Int) -> Hashable UProp
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: UProp -> Int
$chash :: UProp -> Int
hashWithSalt :: Int -> UProp -> Int
$chashWithSalt :: Int -> UProp -> Int
Hashable, Typeable UProp
DataType
Constr
Typeable UProp
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> UProp -> c UProp)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UProp)
-> (UProp -> Constr)
-> (UProp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UProp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UProp))
-> ((forall b. Data b => b -> b) -> UProp -> UProp)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UProp -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UProp -> r)
-> (forall u. (forall d. Data d => d -> u) -> UProp -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> UProp -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> UProp -> m UProp)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UProp -> m UProp)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UProp -> m UProp)
-> Data UProp
UProp -> DataType
UProp -> Constr
(forall b. Data b => b -> b) -> UProp -> UProp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UProp -> c UProp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UProp
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> UProp -> u
forall u. (forall d. Data d => d -> u) -> UProp -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UProp -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UProp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UProp -> m UProp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UProp -> m UProp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UProp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UProp -> c UProp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UProp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UProp)
$cUProp :: Constr
$tUProp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> UProp -> m UProp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UProp -> m UProp
gmapMp :: (forall d. Data d => d -> m d) -> UProp -> m UProp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UProp -> m UProp
gmapM :: (forall d. Data d => d -> m d) -> UProp -> m UProp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UProp -> m UProp
gmapQi :: Int -> (forall d. Data d => d -> u) -> UProp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> UProp -> u
gmapQ :: (forall d. Data d => d -> u) -> UProp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> UProp -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UProp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UProp -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UProp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UProp -> r
gmapT :: (forall b. Data b => b -> b) -> UProp -> UProp
$cgmapT :: (forall b. Data b => b -> b) -> UProp -> UProp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UProp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UProp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UProp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UProp)
dataTypeOf :: UProp -> DataType
$cdataTypeOf :: UProp -> DataType
toConstr :: UProp -> Constr
$ctoConstr :: UProp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UProp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UProp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UProp -> c UProp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UProp -> c UProp
$cp1Data :: Typeable UProp
Data, Typeable, Context -> UProp -> IO (Maybe ThunkInfo)
Proxy UProp -> String
(Context -> UProp -> IO (Maybe ThunkInfo))
-> (Context -> UProp -> IO (Maybe ThunkInfo))
-> (Proxy UProp -> String)
-> NoThunks UProp
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy UProp -> String
$cshowTypeOf :: Proxy UProp -> String
wNoThunks :: Context -> UProp -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> UProp -> IO (Maybe ThunkInfo)
noThunks :: Context -> UProp -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> UProp -> IO (Maybe ThunkInfo)
NoThunks)


-- We need the Hashable instance before making lenses.
instance Hashable a => Hashable (Set a) where
  hashWithSalt :: Int -> Set a -> Int
hashWithSalt = (Set a -> [a]) -> Int -> Set a -> Int
forall b a. Hashable b => (a -> b) -> Int -> a -> Int
H.hashUsing Set a -> [a]
forall a. Set a -> [a]
Set.toList


makeLenses ''UProp


upSigData :: Lens' UProp UpSD
upSigData :: (UpSD -> f UpSD) -> UProp -> f UProp
upSigData = (UProp -> UpSD)
-> (UProp -> UpSD -> UProp) -> Lens UProp UProp UpSD UpSD
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens
  (\UProp
up -> (UProp
up UProp -> Getting ProtVer UProp ProtVer -> ProtVer
forall s a. s -> Getting a s a -> a
^. Getting ProtVer UProp ProtVer
Lens' UProp ProtVer
upPV, UProp
up UProp -> Getting PParams UProp PParams -> PParams
forall s a. s -> Getting a s a -> a
^. Getting PParams UProp PParams
Lens' UProp PParams
upParams, UProp
up UProp -> Getting SwVer UProp SwVer -> SwVer
forall s a. s -> Getting a s a -> a
^. Getting SwVer UProp SwVer
Lens' UProp SwVer
upSwVer, UProp
up UProp -> Getting (Set String) UProp (Set String) -> Set String
forall s a. s -> Getting a s a -> a
^. Getting (Set String) UProp (Set String)
Lens' UProp (Set String)
upSTags, UProp
up UProp -> Getting Metadata UProp Metadata -> Metadata
forall s a. s -> Getting a s a -> a
^. Getting Metadata UProp Metadata
Lens' UProp Metadata
upMdt))
  (\UProp
up (ProtVer
pv, PParams
pps, SwVer
sv, Set String
stags, Metadata
mdt) -> UProp
up
    UProp -> (UProp -> UProp) -> UProp
forall a b. a -> (a -> b) -> b
& (PParams -> Identity PParams) -> UProp -> Identity UProp
Lens' UProp PParams
upParams ((PParams -> Identity PParams) -> UProp -> Identity UProp)
-> PParams -> UProp -> UProp
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams
pps
    UProp -> (UProp -> UProp) -> UProp
forall a b. a -> (a -> b) -> b
& (ProtVer -> Identity ProtVer) -> UProp -> Identity UProp
Lens' UProp ProtVer
upPV ((ProtVer -> Identity ProtVer) -> UProp -> Identity UProp)
-> ProtVer -> UProp -> UProp
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ProtVer
pv
    UProp -> (UProp -> UProp) -> UProp
forall a b. a -> (a -> b) -> b
& (SwVer -> Identity SwVer) -> UProp -> Identity UProp
Lens' UProp SwVer
upSwVer ((SwVer -> Identity SwVer) -> UProp -> Identity UProp)
-> SwVer -> UProp -> UProp
forall s t a b. ASetter s t a b -> b -> s -> t
.~ SwVer
sv
    UProp -> (UProp -> UProp) -> UProp
forall a b. a -> (a -> b) -> b
& (Set String -> Identity (Set String)) -> UProp -> Identity UProp
Lens' UProp (Set String)
upSTags ((Set String -> Identity (Set String)) -> UProp -> Identity UProp)
-> Set String -> UProp -> UProp
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Set String
stags
    UProp -> (UProp -> UProp) -> UProp
forall a b. a -> (a -> b) -> b
& (Metadata -> Identity Metadata) -> UProp -> Identity UProp
Lens' UProp Metadata
upMdt ((Metadata -> Identity Metadata) -> UProp -> Identity UProp)
-> Metadata -> UProp -> UProp
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Metadata
mdt
  )


getUpSigData :: UProp -> UpSD
getUpSigData :: UProp -> UpSD
getUpSigData = Getting UpSD UProp UpSD -> UProp -> UpSD
forall a s. Getting a s a -> s -> a
view Getting UpSD UProp UpSD
Lens UProp UProp UpSD UpSD
upSigData

mkUProp
  :: UpId
  -> Core.VKey
  -> ProtVer
  -> PParams
  -> SwVer
  -> Set STag
  -> Metadata
  -> UProp
mkUProp :: UpId
-> VKey
-> ProtVer
-> PParams
-> SwVer
-> Set String
-> Metadata
-> UProp
mkUProp UpId
aUpId VKey
issuer ProtVer
pv PParams
pps SwVer
sv Set String
stags Metadata
mdt = UProp
uprop
  where
    uprop :: UProp
uprop = UProp :: UpId
-> VKey
-> PParams
-> ProtVer
-> SwVer
-> Sig UpSD
-> Set String
-> Metadata
-> UProp
UProp
            { _upId :: UpId
_upId = UpId
aUpId
            , _upIssuer :: VKey
_upIssuer = VKey
issuer
            , _upParams :: PParams
_upParams = PParams
pps
            , _upPV :: ProtVer
_upPV = ProtVer
pv
            , _upSwVer :: SwVer
_upSwVer = SwVer
sv
            , _upSig :: Sig UpSD
_upSig = SKey -> UpSD -> Sig UpSD
forall a. SKey -> a -> Sig a
Core.sign (VKey -> SKey
skey VKey
issuer) (UProp
uprop UProp -> Getting UpSD UProp UpSD -> UpSD
forall s a. s -> Getting a s a -> a
^. Getting UpSD UProp UpSD
Lens UProp UProp UpSD UpSD
upSigData)
            , _upSTags :: Set String
_upSTags = Set String
stags
            , _upMdt :: Metadata
_upMdt = Metadata
mdt
            }


instance HasTypeReps (ProtVer, PParams, SwVer, Set STag, Metadata)
instance HasTypeReps Metadata
instance HasTypeReps UProp


-- | Test if a pair is present in a map.
inMap :: (Ord key, Eq v) => key -> v -> Map key v -> Bool
inMap :: key -> v -> Map key v -> Bool
inMap key
key v
v Map key v
m = case key -> Map key v -> Maybe v
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup key
key Map key v
m of
  Just v
x | v
x v -> v -> Bool
forall a. Eq a => a -> a -> Bool
== v
v -> Bool
True
  Maybe v
_ -> Bool
False

-- | Invert a map
--
--   Examples:
--
--   >>> invertMap (Map.fromList [('a', 1 :: Int), ('b', 2), ('c', 3), ('d', 1)])
--   fromList [(1,fromList "ad"),(2,fromList "b"),(3,fromList "c")]
invertMap
  :: (Ord k, Ord v)
  => Map k v
  -> Map v (Set k)
invertMap :: Map k v -> Map v (Set k)
invertMap
  = (Set k -> Set k -> Set k) -> [(v, Set k)] -> Map v (Set k)
forall k a. Ord k => (a -> a -> a) -> [(k, a)] -> Map k a
Map.fromListWith (Set k -> Set k -> Set k
forall a. Ord a => Set a -> Set a -> Set a
Set.union)
  ([(v, Set k)] -> Map v (Set k))
-> (Map k v -> [(v, Set k)]) -> Map k v -> Map v (Set k)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((k, v) -> (v, Set k)) -> [(k, v)] -> [(v, Set k)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((k -> Set k) -> (v, k) -> (v, Set k)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap k -> Set k
forall a. a -> Set a
Set.singleton ((v, k) -> (v, Set k))
-> ((k, v) -> (v, k)) -> (k, v) -> (v, Set k)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (k, v) -> (v, k)
forall a b. (a, b) -> (b, a)
swap)
  ([(k, v)] -> [(v, Set k)])
-> (Map k v -> [(k, v)]) -> Map k v -> [(v, Set k)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map k v -> [(k, v)]
forall k a. Map k a -> [(k, a)]
Map.toList

-- | Invert a map which we assert to be a bijection.
--   If this map is not a bijection, the behaviour is not guaranteed.
--
--   Examples:
--
--   >>> invertBijection (Map.fromList [('a', 1 :: Int), ('b', 2), ('c', 3)])
--   fromList [(1,'a'),(2,'b'),(3,'c')]
invertBijection
  :: Ord v
  => Map k v
  -> Map v k
invertBijection :: Map k v -> Map v k
invertBijection
  = (k -> k -> k) -> [(v, k)] -> Map v k
forall k a. Ord k => (a -> a -> a) -> [(k, a)] -> Map k a
Map.fromListWith k -> k -> k
forall a b. a -> b -> a
const
  ([(v, k)] -> Map v k)
-> (Map k v -> [(v, k)]) -> Map k v -> Map v k
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((k, v) -> (v, k)) -> [(k, v)] -> [(v, k)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (k, v) -> (v, k)
forall a b. (a, b) -> (b, a)
swap
  ([(k, v)] -> [(v, k)])
-> (Map k v -> [(k, v)]) -> Map k v -> [(v, k)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map k v -> [(k, v)]
forall k a. Map k a -> [(k, a)]
Map.toList


(==>) :: Bool -> Bool -> Bool
Bool
a ==> :: Bool -> Bool -> Bool
==> Bool
b = Bool -> Bool
not Bool
a Bool -> Bool -> Bool
|| Bool
b
infix 1 ==>

-- | Check whether a protocol version can follow the current protocol version.
pvCanFollow
  :: ProtVer
  -- ^ Next protocol version
  -> ProtVer
  -- ^ Previous protocol version
  -> Bool
pvCanFollow :: ProtVer -> ProtVer -> Bool
pvCanFollow (ProtVer Natural
mjn Natural
mn Natural
an) (ProtVer Natural
mjp Natural
mip Natural
ap)
  = (Natural
mjp, Natural
mip, Natural
ap) (Natural, Natural, Natural) -> (Natural, Natural, Natural) -> Bool
forall a. Ord a => a -> a -> Bool
< (Natural
mjn, Natural
mn, Natural
an)
  Bool -> Bool -> Bool
&& ((Natural, Natural) -> Natural -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (Natural
0,Natural
1) (Natural
mjn Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
- Natural
mjp))
  Bool -> Bool -> Bool
&& ((Natural
mjp Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
mjn) Bool -> Bool -> Bool
==> (Natural
mip Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
+ Natural
1 Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
mn))
  Bool -> Bool -> Bool
&& ((Natural
mjp Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
+ Natural
1 Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
mjn) Bool -> Bool -> Bool
==> (Natural
mn Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
0))

-- | Check whether an update proposal marks a valid update
--
checkUpdateConstraints
  :: PParams
  -> UProp
  -> [UpdateConstraintViolation]
checkUpdateConstraints :: PParams -> UProp -> [UpdateConstraintViolation]
checkUpdateConstraints PParams
pps UProp
prop =
  [Maybe UpdateConstraintViolation] -> [UpdateConstraintViolation]
forall a. [Maybe a] -> [a]
catMaybes
    [ (UProp
prop UProp -> Getting Natural UProp Natural -> Natural
forall s a. s -> Getting a s a -> a
^. (PParams -> Const Natural PParams) -> UProp -> Const Natural UProp
Lens' UProp PParams
upParams ((PParams -> Const Natural PParams)
 -> UProp -> Const Natural UProp)
-> ((Natural -> Const Natural Natural)
    -> PParams -> Const Natural PParams)
-> Getting Natural UProp Natural
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Natural -> Const Natural Natural)
-> PParams -> Const Natural PParams
Lens' PParams Natural
maxBkSz Natural -> Natural -> Maybe (Natural, Threshold Natural)
forall a. Ord a => a -> a -> Maybe (a, Threshold a)
<=? Natural
2 Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
* PParams
pps PParams
-> ((Natural -> Const Natural Natural)
    -> PParams -> Const Natural PParams)
-> Natural
forall s a. s -> Getting a s a -> a
^. (Natural -> Const Natural Natural)
-> PParams -> Const Natural PParams
Lens' PParams Natural
maxBkSz)
        Maybe (Natural, Threshold Natural)
-> (Natural -> Threshold Natural -> UpdateConstraintViolation)
-> Maybe UpdateConstraintViolation
forall a b e. Maybe (a, b) -> (a -> b -> e) -> Maybe e
`orError` Natural -> Threshold Natural -> UpdateConstraintViolation
BlockSizeTooLarge
    , (UProp
prop UProp -> Getting Natural UProp Natural -> Natural
forall s a. s -> Getting a s a -> a
^. (PParams -> Const Natural PParams) -> UProp -> Const Natural UProp
Lens' UProp PParams
upParams ((PParams -> Const Natural PParams)
 -> UProp -> Const Natural UProp)
-> ((Natural -> Const Natural Natural)
    -> PParams -> Const Natural PParams)
-> Getting Natural UProp Natural
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Natural -> Const Natural Natural)
-> PParams -> Const Natural PParams
Lens' PParams Natural
maxTxSz Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
+ Natural
1 Natural -> Natural -> Maybe (Natural, Threshold Natural)
forall a. Ord a => a -> a -> Maybe (a, Threshold a)
<=? UProp
prop UProp -> Getting Natural UProp Natural -> Natural
forall s a. s -> Getting a s a -> a
^. (PParams -> Const Natural PParams) -> UProp -> Const Natural UProp
Lens' UProp PParams
upParams ((PParams -> Const Natural PParams)
 -> UProp -> Const Natural UProp)
-> ((Natural -> Const Natural Natural)
    -> PParams -> Const Natural PParams)
-> Getting Natural UProp Natural
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Natural -> Const Natural Natural)
-> PParams -> Const Natural PParams
Lens' PParams Natural
maxBkSz)
        Maybe (Natural, Threshold Natural)
-> (Natural -> Threshold Natural -> UpdateConstraintViolation)
-> Maybe UpdateConstraintViolation
forall a b e. Maybe (a, b) -> (a -> b -> e) -> Maybe e
`orError` Natural -> Threshold Natural -> UpdateConstraintViolation
TransactionSizeTooLarge
    , (PParams
pps PParams
-> ((Natural -> Const Natural Natural)
    -> PParams -> Const Natural PParams)
-> Natural
forall s a. s -> Getting a s a -> a
^. (Natural -> Const Natural Natural)
-> PParams -> Const Natural PParams
Lens' PParams Natural
scriptVersion Natural -> Natural -> Maybe (Natural, Threshold Natural)
forall a. Ord a => a -> a -> Maybe (a, Threshold a)
<=? UProp
prop UProp -> Getting Natural UProp Natural -> Natural
forall s a. s -> Getting a s a -> a
^. (PParams -> Const Natural PParams) -> UProp -> Const Natural UProp
Lens' UProp PParams
upParams ((PParams -> Const Natural PParams)
 -> UProp -> Const Natural UProp)
-> ((Natural -> Const Natural Natural)
    -> PParams -> Const Natural PParams)
-> Getting Natural UProp Natural
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Natural -> Const Natural Natural)
-> PParams -> Const Natural PParams
Lens' PParams Natural
scriptVersion)
        Maybe (Natural, Threshold Natural)
-> (Natural -> Threshold Natural -> UpdateConstraintViolation)
-> Maybe UpdateConstraintViolation
forall a b e. Maybe (a, b) -> (a -> b -> e) -> Maybe e
`orError` Natural -> Threshold Natural -> UpdateConstraintViolation
ScriptVersionTooSmall
    , (UProp
prop UProp -> Getting Natural UProp Natural -> Natural
forall s a. s -> Getting a s a -> a
^. (PParams -> Const Natural PParams) -> UProp -> Const Natural UProp
Lens' UProp PParams
upParams ((PParams -> Const Natural PParams)
 -> UProp -> Const Natural UProp)
-> ((Natural -> Const Natural Natural)
    -> PParams -> Const Natural PParams)
-> Getting Natural UProp Natural
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Natural -> Const Natural Natural)
-> PParams -> Const Natural PParams
Lens' PParams Natural
scriptVersion Natural -> Natural -> Maybe (Natural, Threshold Natural)
forall a. Ord a => a -> a -> Maybe (a, Threshold a)
<=? PParams
pps PParams
-> ((Natural -> Const Natural Natural)
    -> PParams -> Const Natural PParams)
-> Natural
forall s a. s -> Getting a s a -> a
^. (Natural -> Const Natural Natural)
-> PParams -> Const Natural PParams
Lens' PParams Natural
scriptVersion Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
+ Natural
1)
        Maybe (Natural, Threshold Natural)
-> (Natural -> Threshold Natural -> UpdateConstraintViolation)
-> Maybe UpdateConstraintViolation
forall a b e. Maybe (a, b) -> (a -> b -> e) -> Maybe e
`orError` Natural -> Threshold Natural -> UpdateConstraintViolation
ScriptVersionTooLarge
    ]

(<=?) :: Ord a => a -> a -> Maybe (a, Threshold a)
a
x <=? :: a -> a -> Maybe (a, Threshold a)
<=? a
y = if a
x a -> a -> Bool
forall a. Ord a => a -> a -> Bool
<= a
y then Maybe (a, Threshold a)
forall a. Maybe a
Nothing else (a, Threshold a) -> Maybe (a, Threshold a)
forall a. a -> Maybe a
Just (a
x, a -> Threshold a
forall a. a -> Threshold a
Threshold a
y)

infix 4 <=?

orError :: Maybe (a, b) -> (a -> b -> e) -> Maybe e
orError :: Maybe (a, b) -> (a -> b -> e) -> Maybe e
orError Maybe (a, b)
mab a -> b -> e
ferr = (a -> b -> e) -> (a, b) -> e
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry a -> b -> e
ferr ((a, b) -> e) -> Maybe (a, b) -> Maybe e
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (a, b)
mab

canUpdate :: PParams -> UProp -> Rule UPPVV ctx ()
canUpdate :: PParams -> UProp -> Rule UPPVV ctx ()
canUpdate PParams
pps UProp
prop = [UpdateConstraintViolation]
violations [UpdateConstraintViolation] -> [UpdateConstraintViolation] -> Bool
forall a. Eq a => a -> a -> Bool
== [] Bool -> PredicateFailure UPPVV -> Rule UPPVV ctx ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! [UpdateConstraintViolation] -> UppvvPredicateFailure
CannotUpdatePv [UpdateConstraintViolation]
violations
  where violations :: [UpdateConstraintViolation]
violations = PParams -> UProp -> [UpdateConstraintViolation]
checkUpdateConstraints PParams
pps UProp
prop

-- | Violations on the constraints of the allowed values for new protocol
-- parameters.
data UpdateConstraintViolation
  = BlockSizeTooLarge Natural (Threshold Natural)
  | TransactionSizeTooLarge Natural (Threshold Natural)
  | ScriptVersionTooLarge Natural (Threshold Natural)
  | ScriptVersionTooSmall Natural (Threshold Natural)
  deriving (UpdateConstraintViolation -> UpdateConstraintViolation -> Bool
(UpdateConstraintViolation -> UpdateConstraintViolation -> Bool)
-> (UpdateConstraintViolation -> UpdateConstraintViolation -> Bool)
-> Eq UpdateConstraintViolation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateConstraintViolation -> UpdateConstraintViolation -> Bool
$c/= :: UpdateConstraintViolation -> UpdateConstraintViolation -> Bool
== :: UpdateConstraintViolation -> UpdateConstraintViolation -> Bool
$c== :: UpdateConstraintViolation -> UpdateConstraintViolation -> Bool
Eq, Eq UpdateConstraintViolation
Eq UpdateConstraintViolation
-> (UpdateConstraintViolation
    -> UpdateConstraintViolation -> Ordering)
-> (UpdateConstraintViolation -> UpdateConstraintViolation -> Bool)
-> (UpdateConstraintViolation -> UpdateConstraintViolation -> Bool)
-> (UpdateConstraintViolation -> UpdateConstraintViolation -> Bool)
-> (UpdateConstraintViolation -> UpdateConstraintViolation -> Bool)
-> (UpdateConstraintViolation
    -> UpdateConstraintViolation -> UpdateConstraintViolation)
-> (UpdateConstraintViolation
    -> UpdateConstraintViolation -> UpdateConstraintViolation)
-> Ord UpdateConstraintViolation
UpdateConstraintViolation -> UpdateConstraintViolation -> Bool
UpdateConstraintViolation -> UpdateConstraintViolation -> Ordering
UpdateConstraintViolation
-> UpdateConstraintViolation -> UpdateConstraintViolation
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
min :: UpdateConstraintViolation
-> UpdateConstraintViolation -> UpdateConstraintViolation
$cmin :: UpdateConstraintViolation
-> UpdateConstraintViolation -> UpdateConstraintViolation
max :: UpdateConstraintViolation
-> UpdateConstraintViolation -> UpdateConstraintViolation
$cmax :: UpdateConstraintViolation
-> UpdateConstraintViolation -> UpdateConstraintViolation
>= :: UpdateConstraintViolation -> UpdateConstraintViolation -> Bool
$c>= :: UpdateConstraintViolation -> UpdateConstraintViolation -> Bool
> :: UpdateConstraintViolation -> UpdateConstraintViolation -> Bool
$c> :: UpdateConstraintViolation -> UpdateConstraintViolation -> Bool
<= :: UpdateConstraintViolation -> UpdateConstraintViolation -> Bool
$c<= :: UpdateConstraintViolation -> UpdateConstraintViolation -> Bool
< :: UpdateConstraintViolation -> UpdateConstraintViolation -> Bool
$c< :: UpdateConstraintViolation -> UpdateConstraintViolation -> Bool
compare :: UpdateConstraintViolation -> UpdateConstraintViolation -> Ordering
$ccompare :: UpdateConstraintViolation -> UpdateConstraintViolation -> Ordering
$cp1Ord :: Eq UpdateConstraintViolation
Ord, Int -> UpdateConstraintViolation -> ShowS
[UpdateConstraintViolation] -> ShowS
UpdateConstraintViolation -> String
(Int -> UpdateConstraintViolation -> ShowS)
-> (UpdateConstraintViolation -> String)
-> ([UpdateConstraintViolation] -> ShowS)
-> Show UpdateConstraintViolation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateConstraintViolation] -> ShowS
$cshowList :: [UpdateConstraintViolation] -> ShowS
show :: UpdateConstraintViolation -> String
$cshow :: UpdateConstraintViolation -> String
showsPrec :: Int -> UpdateConstraintViolation -> ShowS
$cshowsPrec :: Int -> UpdateConstraintViolation -> ShowS
Show, Typeable UpdateConstraintViolation
DataType
Constr
Typeable UpdateConstraintViolation
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> UpdateConstraintViolation
    -> c UpdateConstraintViolation)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UpdateConstraintViolation)
-> (UpdateConstraintViolation -> Constr)
-> (UpdateConstraintViolation -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d))
    -> Maybe (c UpdateConstraintViolation))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c UpdateConstraintViolation))
-> ((forall b. Data b => b -> b)
    -> UpdateConstraintViolation -> UpdateConstraintViolation)
-> (forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> UpdateConstraintViolation
    -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> UpdateConstraintViolation
    -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> UpdateConstraintViolation -> [u])
-> (forall u.
    Int
    -> (forall d. Data d => d -> u) -> UpdateConstraintViolation -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> UpdateConstraintViolation -> m UpdateConstraintViolation)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UpdateConstraintViolation -> m UpdateConstraintViolation)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UpdateConstraintViolation -> m UpdateConstraintViolation)
-> Data UpdateConstraintViolation
UpdateConstraintViolation -> DataType
UpdateConstraintViolation -> Constr
(forall b. Data b => b -> b)
-> UpdateConstraintViolation -> UpdateConstraintViolation
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpdateConstraintViolation
-> c UpdateConstraintViolation
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpdateConstraintViolation
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int
-> (forall d. Data d => d -> u) -> UpdateConstraintViolation -> u
forall u.
(forall d. Data d => d -> u) -> UpdateConstraintViolation -> [u]
forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpdateConstraintViolation
-> r
forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpdateConstraintViolation
-> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UpdateConstraintViolation -> m UpdateConstraintViolation
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpdateConstraintViolation -> m UpdateConstraintViolation
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpdateConstraintViolation
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpdateConstraintViolation
-> c UpdateConstraintViolation
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d))
-> Maybe (c UpdateConstraintViolation)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpdateConstraintViolation)
$cScriptVersionTooSmall :: Constr
$cScriptVersionTooLarge :: Constr
$cTransactionSizeTooLarge :: Constr
$cBlockSizeTooLarge :: Constr
$tUpdateConstraintViolation :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> UpdateConstraintViolation -> m UpdateConstraintViolation
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpdateConstraintViolation -> m UpdateConstraintViolation
gmapMp :: (forall d. Data d => d -> m d)
-> UpdateConstraintViolation -> m UpdateConstraintViolation
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpdateConstraintViolation -> m UpdateConstraintViolation
gmapM :: (forall d. Data d => d -> m d)
-> UpdateConstraintViolation -> m UpdateConstraintViolation
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UpdateConstraintViolation -> m UpdateConstraintViolation
gmapQi :: Int
-> (forall d. Data d => d -> u) -> UpdateConstraintViolation -> u
$cgmapQi :: forall u.
Int
-> (forall d. Data d => d -> u) -> UpdateConstraintViolation -> u
gmapQ :: (forall d. Data d => d -> u) -> UpdateConstraintViolation -> [u]
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> UpdateConstraintViolation -> [u]
gmapQr :: (r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpdateConstraintViolation
-> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpdateConstraintViolation
-> r
gmapQl :: (r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpdateConstraintViolation
-> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpdateConstraintViolation
-> r
gmapT :: (forall b. Data b => b -> b)
-> UpdateConstraintViolation -> UpdateConstraintViolation
$cgmapT :: (forall b. Data b => b -> b)
-> UpdateConstraintViolation -> UpdateConstraintViolation
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpdateConstraintViolation)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpdateConstraintViolation)
dataCast1 :: (forall d. Data d => c (t d))
-> Maybe (c UpdateConstraintViolation)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d))
-> Maybe (c UpdateConstraintViolation)
dataTypeOf :: UpdateConstraintViolation -> DataType
$cdataTypeOf :: UpdateConstraintViolation -> DataType
toConstr :: UpdateConstraintViolation -> Constr
$ctoConstr :: UpdateConstraintViolation -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpdateConstraintViolation
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpdateConstraintViolation
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpdateConstraintViolation
-> c UpdateConstraintViolation
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpdateConstraintViolation
-> c UpdateConstraintViolation
$cp1Data :: Typeable UpdateConstraintViolation
Data, Typeable, (forall x.
 UpdateConstraintViolation -> Rep UpdateConstraintViolation x)
-> (forall x.
    Rep UpdateConstraintViolation x -> UpdateConstraintViolation)
-> Generic UpdateConstraintViolation
forall x.
Rep UpdateConstraintViolation x -> UpdateConstraintViolation
forall x.
UpdateConstraintViolation -> Rep UpdateConstraintViolation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateConstraintViolation x -> UpdateConstraintViolation
$cfrom :: forall x.
UpdateConstraintViolation -> Rep UpdateConstraintViolation x
Generic, Context -> UpdateConstraintViolation -> IO (Maybe ThunkInfo)
Proxy UpdateConstraintViolation -> String
(Context -> UpdateConstraintViolation -> IO (Maybe ThunkInfo))
-> (Context -> UpdateConstraintViolation -> IO (Maybe ThunkInfo))
-> (Proxy UpdateConstraintViolation -> String)
-> NoThunks UpdateConstraintViolation
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy UpdateConstraintViolation -> String
$cshowTypeOf :: Proxy UpdateConstraintViolation -> String
wNoThunks :: Context -> UpdateConstraintViolation -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> UpdateConstraintViolation -> IO (Maybe ThunkInfo)
noThunks :: Context -> UpdateConstraintViolation -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> UpdateConstraintViolation -> IO (Maybe ThunkInfo)
NoThunks)

svCanFollow
  :: Map ApName (ApVer, Core.Slot, Metadata)
  -> (ApName, ApVer)
  -> Bool
svCanFollow :: Map ApName (ApVer, Slot, Metadata) -> (ApName, ApVer) -> Bool
svCanFollow Map ApName (ApVer, Slot, Metadata)
avs (ApName
an,ApVer
av) =
    (case ApName
-> Map ApName (ApVer, Slot, Metadata)
-> Maybe (ApVer, Slot, Metadata)
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup ApName
an Map ApName (ApVer, Slot, Metadata)
avs of
      Maybe (ApVer, Slot, Metadata)
Nothing -> Bool
True
      Just (ApVer
x, Slot
_, Metadata
_) -> ApVer
av ApVer -> ApVer -> Bool
forall a. Eq a => a -> a -> Bool
== ApVer
x ApVer -> ApVer -> ApVer
forall a. Num a => a -> a -> a
+ ApVer
1
    ) Bool -> Bool -> Bool
&& (ApName
an ApName -> Set ApName -> Bool
forall a. Ord a => a -> Set a -> Bool
`Set.notMember` Map ApName (ApVer, Slot, Metadata)
-> Set (Domain (Map ApName (ApVer, Slot, Metadata)))
forall m. (Relation m, Ord (Domain m)) => m -> Set (Domain m)
dom Map ApName (ApVer, Slot, Metadata)
avs Bool -> Bool -> Bool
==> (ApVer
av ApVer -> ApVer -> Bool
forall a. Eq a => a -> a -> Bool
== Natural -> ApVer
ApVer Natural
0 Bool -> Bool -> Bool
|| ApVer
av ApVer -> ApVer -> Bool
forall a. Eq a => a -> a -> Bool
== Natural -> ApVer
ApVer Natural
1))
  where

------------------------------------------------------------------------
-- Update proposals
------------------------------------------------------------------------

-- | Update Proposal Software Version Validation
data UPSVV deriving ((forall x. UPSVV -> Rep UPSVV x)
-> (forall x. Rep UPSVV x -> UPSVV) -> Generic UPSVV
forall x. Rep UPSVV x -> UPSVV
forall x. UPSVV -> Rep UPSVV x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UPSVV x -> UPSVV
$cfrom :: forall x. UPSVV -> Rep UPSVV x
Generic, Typeable UPSVV
DataType
Typeable UPSVV
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> UPSVV -> c UPSVV)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UPSVV)
-> (UPSVV -> Constr)
-> (UPSVV -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UPSVV))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPSVV))
-> ((forall b. Data b => b -> b) -> UPSVV -> UPSVV)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPSVV -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPSVV -> r)
-> (forall u. (forall d. Data d => d -> u) -> UPSVV -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> UPSVV -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> UPSVV -> m UPSVV)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UPSVV -> m UPSVV)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UPSVV -> m UPSVV)
-> Data UPSVV
UPSVV -> DataType
UPSVV -> Constr
(forall b. Data b => b -> b) -> UPSVV -> UPSVV
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPSVV -> c UPSVV
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPSVV
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> UPSVV -> u
forall u. (forall d. Data d => d -> u) -> UPSVV -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPSVV -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPSVV -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UPSVV -> m UPSVV
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPSVV -> m UPSVV
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPSVV
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPSVV -> c UPSVV
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UPSVV)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPSVV)
$tUPSVV :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> UPSVV -> m UPSVV
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPSVV -> m UPSVV
gmapMp :: (forall d. Data d => d -> m d) -> UPSVV -> m UPSVV
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPSVV -> m UPSVV
gmapM :: (forall d. Data d => d -> m d) -> UPSVV -> m UPSVV
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UPSVV -> m UPSVV
gmapQi :: Int -> (forall d. Data d => d -> u) -> UPSVV -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> UPSVV -> u
gmapQ :: (forall d. Data d => d -> u) -> UPSVV -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> UPSVV -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPSVV -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPSVV -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPSVV -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPSVV -> r
gmapT :: (forall b. Data b => b -> b) -> UPSVV -> UPSVV
$cgmapT :: (forall b. Data b => b -> b) -> UPSVV -> UPSVV
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPSVV)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPSVV)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UPSVV)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UPSVV)
dataTypeOf :: UPSVV -> DataType
$cdataTypeOf :: UPSVV -> DataType
toConstr :: UPSVV -> Constr
$ctoConstr :: UPSVV -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPSVV
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPSVV
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPSVV -> c UPSVV
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPSVV -> c UPSVV
$cp1Data :: Typeable UPSVV
Data, Typeable)

-- | These `PredicateFailure`s are all "throwable". The disjunction of the
--   rules' preconditions is not `True` - the `PredicateFailure`s represent
--   `False` cases.
data UpsvvPredicateFailure
  = AlreadyProposedSv
  | CannotFollowSv
  | InvalidApplicationName
  | InvalidSystemTags
  deriving (UpsvvPredicateFailure -> UpsvvPredicateFailure -> Bool
(UpsvvPredicateFailure -> UpsvvPredicateFailure -> Bool)
-> (UpsvvPredicateFailure -> UpsvvPredicateFailure -> Bool)
-> Eq UpsvvPredicateFailure
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpsvvPredicateFailure -> UpsvvPredicateFailure -> Bool
$c/= :: UpsvvPredicateFailure -> UpsvvPredicateFailure -> Bool
== :: UpsvvPredicateFailure -> UpsvvPredicateFailure -> Bool
$c== :: UpsvvPredicateFailure -> UpsvvPredicateFailure -> Bool
Eq, Int -> UpsvvPredicateFailure -> ShowS
[UpsvvPredicateFailure] -> ShowS
UpsvvPredicateFailure -> String
(Int -> UpsvvPredicateFailure -> ShowS)
-> (UpsvvPredicateFailure -> String)
-> ([UpsvvPredicateFailure] -> ShowS)
-> Show UpsvvPredicateFailure
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpsvvPredicateFailure] -> ShowS
$cshowList :: [UpsvvPredicateFailure] -> ShowS
show :: UpsvvPredicateFailure -> String
$cshow :: UpsvvPredicateFailure -> String
showsPrec :: Int -> UpsvvPredicateFailure -> ShowS
$cshowsPrec :: Int -> UpsvvPredicateFailure -> ShowS
Show, Typeable UpsvvPredicateFailure
DataType
Constr
Typeable UpsvvPredicateFailure
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> UpsvvPredicateFailure
    -> c UpsvvPredicateFailure)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UpsvvPredicateFailure)
-> (UpsvvPredicateFailure -> Constr)
-> (UpsvvPredicateFailure -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UpsvvPredicateFailure))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c UpsvvPredicateFailure))
-> ((forall b. Data b => b -> b)
    -> UpsvvPredicateFailure -> UpsvvPredicateFailure)
-> (forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> UpsvvPredicateFailure
    -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> UpsvvPredicateFailure
    -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> UpsvvPredicateFailure -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> UpsvvPredicateFailure -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> UpsvvPredicateFailure -> m UpsvvPredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UpsvvPredicateFailure -> m UpsvvPredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UpsvvPredicateFailure -> m UpsvvPredicateFailure)
-> Data UpsvvPredicateFailure
UpsvvPredicateFailure -> DataType
UpsvvPredicateFailure -> Constr
(forall b. Data b => b -> b)
-> UpsvvPredicateFailure -> UpsvvPredicateFailure
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpsvvPredicateFailure
-> c UpsvvPredicateFailure
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpsvvPredicateFailure
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> UpsvvPredicateFailure -> u
forall u.
(forall d. Data d => d -> u) -> UpsvvPredicateFailure -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpsvvPredicateFailure -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpsvvPredicateFailure -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UpsvvPredicateFailure -> m UpsvvPredicateFailure
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpsvvPredicateFailure -> m UpsvvPredicateFailure
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpsvvPredicateFailure
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpsvvPredicateFailure
-> c UpsvvPredicateFailure
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UpsvvPredicateFailure)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpsvvPredicateFailure)
$cInvalidSystemTags :: Constr
$cInvalidApplicationName :: Constr
$cCannotFollowSv :: Constr
$cAlreadyProposedSv :: Constr
$tUpsvvPredicateFailure :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> UpsvvPredicateFailure -> m UpsvvPredicateFailure
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpsvvPredicateFailure -> m UpsvvPredicateFailure
gmapMp :: (forall d. Data d => d -> m d)
-> UpsvvPredicateFailure -> m UpsvvPredicateFailure
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpsvvPredicateFailure -> m UpsvvPredicateFailure
gmapM :: (forall d. Data d => d -> m d)
-> UpsvvPredicateFailure -> m UpsvvPredicateFailure
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UpsvvPredicateFailure -> m UpsvvPredicateFailure
gmapQi :: Int -> (forall d. Data d => d -> u) -> UpsvvPredicateFailure -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> UpsvvPredicateFailure -> u
gmapQ :: (forall d. Data d => d -> u) -> UpsvvPredicateFailure -> [u]
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> UpsvvPredicateFailure -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpsvvPredicateFailure -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpsvvPredicateFailure -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpsvvPredicateFailure -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpsvvPredicateFailure -> r
gmapT :: (forall b. Data b => b -> b)
-> UpsvvPredicateFailure -> UpsvvPredicateFailure
$cgmapT :: (forall b. Data b => b -> b)
-> UpsvvPredicateFailure -> UpsvvPredicateFailure
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpsvvPredicateFailure)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpsvvPredicateFailure)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UpsvvPredicateFailure)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UpsvvPredicateFailure)
dataTypeOf :: UpsvvPredicateFailure -> DataType
$cdataTypeOf :: UpsvvPredicateFailure -> DataType
toConstr :: UpsvvPredicateFailure -> Constr
$ctoConstr :: UpsvvPredicateFailure -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpsvvPredicateFailure
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpsvvPredicateFailure
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpsvvPredicateFailure
-> c UpsvvPredicateFailure
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpsvvPredicateFailure
-> c UpsvvPredicateFailure
$cp1Data :: Typeable UpsvvPredicateFailure
Data, Typeable, (forall x. UpsvvPredicateFailure -> Rep UpsvvPredicateFailure x)
-> (forall x. Rep UpsvvPredicateFailure x -> UpsvvPredicateFailure)
-> Generic UpsvvPredicateFailure
forall x. Rep UpsvvPredicateFailure x -> UpsvvPredicateFailure
forall x. UpsvvPredicateFailure -> Rep UpsvvPredicateFailure x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpsvvPredicateFailure x -> UpsvvPredicateFailure
$cfrom :: forall x. UpsvvPredicateFailure -> Rep UpsvvPredicateFailure x
Generic, Context -> UpsvvPredicateFailure -> IO (Maybe ThunkInfo)
Proxy UpsvvPredicateFailure -> String
(Context -> UpsvvPredicateFailure -> IO (Maybe ThunkInfo))
-> (Context -> UpsvvPredicateFailure -> IO (Maybe ThunkInfo))
-> (Proxy UpsvvPredicateFailure -> String)
-> NoThunks UpsvvPredicateFailure
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy UpsvvPredicateFailure -> String
$cshowTypeOf :: Proxy UpsvvPredicateFailure -> String
wNoThunks :: Context -> UpsvvPredicateFailure -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> UpsvvPredicateFailure -> IO (Maybe ThunkInfo)
noThunks :: Context -> UpsvvPredicateFailure -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> UpsvvPredicateFailure -> IO (Maybe ThunkInfo)
NoThunks)


instance STS UPSVV where
  type Environment UPSVV = Map ApName (ApVer, Core.Slot, Metadata)
  type State UPSVV = Map UpId (ApName, ApVer, Metadata)
  type Signal UPSVV = UProp
  type PredicateFailure UPSVV = UpsvvPredicateFailure

  initialRules :: [InitialRule UPSVV]
initialRules = []
  transitionRules :: [TransitionRule UPSVV]
transitionRules =
    [ do
        TRC (Environment UPSVV
avs, State UPSVV
raus, Signal UPSVV
up) <- F (Clause UPSVV 'Transition) (TRC UPSVV)
forall sts (rtype :: RuleType).
Rule sts rtype (RuleContext rtype sts)
judgmentContext
        let SwVer ApName
an ApVer
av = Signal UPSVV
UProp
up UProp -> Getting SwVer UProp SwVer -> SwVer
forall s a. s -> Getting a s a -> a
^. Getting SwVer UProp SwVer
Lens' UProp SwVer
upSwVer
        ApName -> Bool
apNameValid ApName
an Bool -> PredicateFailure UPSVV -> Rule UPSVV 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure UPSVV
UpsvvPredicateFailure
InvalidApplicationName
        Map ApName (ApVer, Slot, Metadata) -> (ApName, ApVer) -> Bool
svCanFollow Map ApName (ApVer, Slot, Metadata)
Environment UPSVV
avs (ApName
an,ApVer
av) Bool -> PredicateFailure UPSVV -> Rule UPSVV 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure UPSVV
UpsvvPredicateFailure
CannotFollowSv
        ApName
an ApName -> [ApName] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`notElem` ((ApName, ApVer, Metadata) -> ApName)
-> [(ApName, ApVer, Metadata)] -> [ApName]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (ApName, ApVer, Metadata) -> ApName
forall a b c. (a, b, c) -> a
fst' (Map UpId (ApName, ApVer, Metadata) -> [(ApName, ApVer, Metadata)]
forall k a. Map k a -> [a]
Map.elems Map UpId (ApName, ApVer, Metadata)
State UPSVV
raus) Bool -> PredicateFailure UPSVV -> Rule UPSVV 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure UPSVV
UpsvvPredicateFailure
AlreadyProposedSv
        (String -> Bool) -> Set String -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all String -> Bool
forall (t :: * -> *). Foldable t => t Char -> Bool
sTagValid (Signal UPSVV
UProp
up UProp -> Getting (Set String) UProp (Set String) -> Set String
forall s a. s -> Getting a s a -> a
^. Getting (Set String) UProp (Set String)
Lens' UProp (Set String)
upSTags) Bool -> PredicateFailure UPSVV -> Rule UPSVV 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure UPSVV
UpsvvPredicateFailure
InvalidSystemTags
        Map UpId (ApName, ApVer, Metadata)
-> F (Clause UPSVV 'Transition)
     (Map UpId (ApName, ApVer, Metadata))
forall (m :: * -> *) a. Monad m => a -> m a
return (Map UpId (ApName, ApVer, Metadata)
 -> F (Clause UPSVV 'Transition)
      (Map UpId (ApName, ApVer, Metadata)))
-> Map UpId (ApName, ApVer, Metadata)
-> F (Clause UPSVV 'Transition)
     (Map UpId (ApName, ApVer, Metadata))
forall a b. (a -> b) -> a -> b
$! Map UpId (ApName, ApVer, Metadata)
State UPSVV
raus Map UpId (ApName, ApVer, Metadata)
-> [(Domain (Map UpId (ApName, ApVer, Metadata)),
     Range (Map UpId (ApName, ApVer, Metadata)))]
-> Map UpId (ApName, ApVer, Metadata)
forall m (f :: * -> *).
(Relation m, Ord (Domain m), Ord (Range m), Foldable f) =>
m -> f (Domain m, Range m) -> m
 [(Signal UPSVV
UProp
up UProp -> Getting UpId UProp UpId -> UpId
forall s a. s -> Getting a s a -> a
^. Getting UpId UProp UpId
Lens' UProp UpId
upId, (ApName
an, ApVer
av, Signal UPSVV
UProp
up UProp -> Getting Metadata UProp Metadata -> Metadata
forall s a. s -> Getting a s a -> a
^. Getting Metadata UProp Metadata
Lens' UProp Metadata
upMdt))]
    ]
    where
      fst' :: (a, b, c) -> a
fst' (a
x, b
_, c
_) = a
x

      apNameValid :: ApName -> Bool
apNameValid (ApName String
n) = (Char -> Bool) -> String -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all Char -> Bool
isAscii String
n Bool -> Bool -> Bool
&& String -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
12

      sTagValid :: t Char -> Bool
sTagValid t Char
tag = (Char -> Bool) -> t Char -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all Char -> Bool
isAscii t Char
tag Bool -> Bool -> Bool
&& t Char -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length t Char
tag Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
10

data UPPVV deriving ((forall x. UPPVV -> Rep UPPVV x)
-> (forall x. Rep UPPVV x -> UPPVV) -> Generic UPPVV
forall x. Rep UPPVV x -> UPPVV
forall x. UPPVV -> Rep UPPVV x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UPPVV x -> UPPVV
$cfrom :: forall x. UPPVV -> Rep UPPVV x
Generic, Typeable UPPVV
DataType
Typeable UPPVV
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> UPPVV -> c UPPVV)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UPPVV)
-> (UPPVV -> Constr)
-> (UPPVV -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UPPVV))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPPVV))
-> ((forall b. Data b => b -> b) -> UPPVV -> UPPVV)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPPVV -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPPVV -> r)
-> (forall u. (forall d. Data d => d -> u) -> UPPVV -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> UPPVV -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> UPPVV -> m UPPVV)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UPPVV -> m UPPVV)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UPPVV -> m UPPVV)
-> Data UPPVV
UPPVV -> DataType
UPPVV -> Constr
(forall b. Data b => b -> b) -> UPPVV -> UPPVV
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPPVV -> c UPPVV
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPPVV
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> UPPVV -> u
forall u. (forall d. Data d => d -> u) -> UPPVV -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPPVV -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPPVV -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UPPVV -> m UPPVV
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPPVV -> m UPPVV
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPPVV
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPPVV -> c UPPVV
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UPPVV)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPPVV)
$tUPPVV :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> UPPVV -> m UPPVV
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPPVV -> m UPPVV
gmapMp :: (forall d. Data d => d -> m d) -> UPPVV -> m UPPVV
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPPVV -> m UPPVV
gmapM :: (forall d. Data d => d -> m d) -> UPPVV -> m UPPVV
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UPPVV -> m UPPVV
gmapQi :: Int -> (forall d. Data d => d -> u) -> UPPVV -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> UPPVV -> u
gmapQ :: (forall d. Data d => d -> u) -> UPPVV -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> UPPVV -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPPVV -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPPVV -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPPVV -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPPVV -> r
gmapT :: (forall b. Data b => b -> b) -> UPPVV -> UPPVV
$cgmapT :: (forall b. Data b => b -> b) -> UPPVV -> UPPVV
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPPVV)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPPVV)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UPPVV)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UPPVV)
dataTypeOf :: UPPVV -> DataType
$cdataTypeOf :: UPPVV -> DataType
toConstr :: UPPVV -> Constr
$ctoConstr :: UPPVV -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPPVV
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPPVV
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPPVV -> c UPPVV
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPPVV -> c UPPVV
$cp1Data :: Typeable UPPVV
Data, Typeable)

-- | These `PredicateFailure`s are all "throwable". The disjunction of the
--   rules' preconditions is not `True` - the `PredicateFailure`s represent
--   `False` cases.
data UppvvPredicateFailure
  = CannotFollowPv
  | CannotUpdatePv [UpdateConstraintViolation]
  | AlreadyProposedPv
  deriving (UppvvPredicateFailure -> UppvvPredicateFailure -> Bool
(UppvvPredicateFailure -> UppvvPredicateFailure -> Bool)
-> (UppvvPredicateFailure -> UppvvPredicateFailure -> Bool)
-> Eq UppvvPredicateFailure
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UppvvPredicateFailure -> UppvvPredicateFailure -> Bool
$c/= :: UppvvPredicateFailure -> UppvvPredicateFailure -> Bool
== :: UppvvPredicateFailure -> UppvvPredicateFailure -> Bool
$c== :: UppvvPredicateFailure -> UppvvPredicateFailure -> Bool
Eq, Int -> UppvvPredicateFailure -> ShowS
[UppvvPredicateFailure] -> ShowS
UppvvPredicateFailure -> String
(Int -> UppvvPredicateFailure -> ShowS)
-> (UppvvPredicateFailure -> String)
-> ([UppvvPredicateFailure] -> ShowS)
-> Show UppvvPredicateFailure
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UppvvPredicateFailure] -> ShowS
$cshowList :: [UppvvPredicateFailure] -> ShowS
show :: UppvvPredicateFailure -> String
$cshow :: UppvvPredicateFailure -> String
showsPrec :: Int -> UppvvPredicateFailure -> ShowS
$cshowsPrec :: Int -> UppvvPredicateFailure -> ShowS
Show, Typeable UppvvPredicateFailure
DataType
Constr
Typeable UppvvPredicateFailure
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> UppvvPredicateFailure
    -> c UppvvPredicateFailure)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UppvvPredicateFailure)
-> (UppvvPredicateFailure -> Constr)
-> (UppvvPredicateFailure -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UppvvPredicateFailure))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c UppvvPredicateFailure))
-> ((forall b. Data b => b -> b)
    -> UppvvPredicateFailure -> UppvvPredicateFailure)
-> (forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> UppvvPredicateFailure
    -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> UppvvPredicateFailure
    -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> UppvvPredicateFailure -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> UppvvPredicateFailure -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> UppvvPredicateFailure -> m UppvvPredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UppvvPredicateFailure -> m UppvvPredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UppvvPredicateFailure -> m UppvvPredicateFailure)
-> Data UppvvPredicateFailure
UppvvPredicateFailure -> DataType
UppvvPredicateFailure -> Constr
(forall b. Data b => b -> b)
-> UppvvPredicateFailure -> UppvvPredicateFailure
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UppvvPredicateFailure
-> c UppvvPredicateFailure
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UppvvPredicateFailure
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> UppvvPredicateFailure -> u
forall u.
(forall d. Data d => d -> u) -> UppvvPredicateFailure -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UppvvPredicateFailure -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UppvvPredicateFailure -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UppvvPredicateFailure -> m UppvvPredicateFailure
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UppvvPredicateFailure -> m UppvvPredicateFailure
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UppvvPredicateFailure
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UppvvPredicateFailure
-> c UppvvPredicateFailure
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UppvvPredicateFailure)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UppvvPredicateFailure)
$cAlreadyProposedPv :: Constr
$cCannotUpdatePv :: Constr
$cCannotFollowPv :: Constr
$tUppvvPredicateFailure :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> UppvvPredicateFailure -> m UppvvPredicateFailure
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UppvvPredicateFailure -> m UppvvPredicateFailure
gmapMp :: (forall d. Data d => d -> m d)
-> UppvvPredicateFailure -> m UppvvPredicateFailure
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UppvvPredicateFailure -> m UppvvPredicateFailure
gmapM :: (forall d. Data d => d -> m d)
-> UppvvPredicateFailure -> m UppvvPredicateFailure
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UppvvPredicateFailure -> m UppvvPredicateFailure
gmapQi :: Int -> (forall d. Data d => d -> u) -> UppvvPredicateFailure -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> UppvvPredicateFailure -> u
gmapQ :: (forall d. Data d => d -> u) -> UppvvPredicateFailure -> [u]
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> UppvvPredicateFailure -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UppvvPredicateFailure -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UppvvPredicateFailure -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UppvvPredicateFailure -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UppvvPredicateFailure -> r
gmapT :: (forall b. Data b => b -> b)
-> UppvvPredicateFailure -> UppvvPredicateFailure
$cgmapT :: (forall b. Data b => b -> b)
-> UppvvPredicateFailure -> UppvvPredicateFailure
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UppvvPredicateFailure)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UppvvPredicateFailure)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UppvvPredicateFailure)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UppvvPredicateFailure)
dataTypeOf :: UppvvPredicateFailure -> DataType
$cdataTypeOf :: UppvvPredicateFailure -> DataType
toConstr :: UppvvPredicateFailure -> Constr
$ctoConstr :: UppvvPredicateFailure -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UppvvPredicateFailure
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UppvvPredicateFailure
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UppvvPredicateFailure
-> c UppvvPredicateFailure
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UppvvPredicateFailure
-> c UppvvPredicateFailure
$cp1Data :: Typeable UppvvPredicateFailure
Data, Typeable, (forall x. UppvvPredicateFailure -> Rep UppvvPredicateFailure x)
-> (forall x. Rep UppvvPredicateFailure x -> UppvvPredicateFailure)
-> Generic UppvvPredicateFailure
forall x. Rep UppvvPredicateFailure x -> UppvvPredicateFailure
forall x. UppvvPredicateFailure -> Rep UppvvPredicateFailure x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UppvvPredicateFailure x -> UppvvPredicateFailure
$cfrom :: forall x. UppvvPredicateFailure -> Rep UppvvPredicateFailure x
Generic, Context -> UppvvPredicateFailure -> IO (Maybe ThunkInfo)
Proxy UppvvPredicateFailure -> String
(Context -> UppvvPredicateFailure -> IO (Maybe ThunkInfo))
-> (Context -> UppvvPredicateFailure -> IO (Maybe ThunkInfo))
-> (Proxy UppvvPredicateFailure -> String)
-> NoThunks UppvvPredicateFailure
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy UppvvPredicateFailure -> String
$cshowTypeOf :: Proxy UppvvPredicateFailure -> String
wNoThunks :: Context -> UppvvPredicateFailure -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> UppvvPredicateFailure -> IO (Maybe ThunkInfo)
noThunks :: Context -> UppvvPredicateFailure -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> UppvvPredicateFailure -> IO (Maybe ThunkInfo)
NoThunks)

instance STS UPPVV where
  type Environment UPPVV =
    ( ProtVer
    , PParams
    )
  type State UPPVV = Map UpId (ProtVer, PParams)
  type Signal UPPVV = UProp
  type PredicateFailure UPPVV = UppvvPredicateFailure

  initialRules :: [InitialRule UPPVV]
initialRules = []
  transitionRules :: [TransitionRule UPPVV]
transitionRules =
    [ do
        TRC ((pv, pps), State UPPVV
rpus, Signal UPPVV
up) <- F (Clause UPPVV 'Transition) (TRC UPPVV)
forall sts (rtype :: RuleType).
Rule sts rtype (RuleContext rtype sts)
judgmentContext
        let pid :: UpId
pid = Signal UPPVV
UProp
up UProp -> Getting UpId UProp UpId -> UpId
forall s a. s -> Getting a s a -> a
^. Getting UpId UProp UpId
Lens' UProp UpId
upId
            nv :: ProtVer
nv = Signal UPPVV
UProp
up UProp -> Getting ProtVer UProp ProtVer -> ProtVer
forall s a. s -> Getting a s a -> a
^. Getting ProtVer UProp ProtVer
Lens' UProp ProtVer
upPV
            ppsn :: PParams
ppsn = Signal UPPVV
UProp
up UProp -> Getting PParams UProp PParams -> PParams
forall s a. s -> Getting a s a -> a
^. Getting PParams UProp PParams
Lens' UProp PParams
upParams
        ProtVer -> ProtVer -> Bool
pvCanFollow ProtVer
nv ProtVer
pv Bool -> PredicateFailure UPPVV -> Rule UPPVV 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure UPPVV
UppvvPredicateFailure
CannotFollowPv
        PParams -> UProp -> Rule UPPVV 'Transition ()
forall (ctx :: RuleType). PParams -> UProp -> Rule UPPVV ctx ()
canUpdate PParams
pps Signal UPPVV
UProp
up
        ProtVer
nv ProtVer -> [ProtVer] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`notElem` ((ProtVer, PParams) -> ProtVer
forall a b. (a, b) -> a
fst ((ProtVer, PParams) -> ProtVer)
-> [(ProtVer, PParams)] -> [ProtVer]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Map UpId (ProtVer, PParams) -> [(ProtVer, PParams)]
forall k a. Map k a -> [a]
Map.elems Map UpId (ProtVer, PParams)
State UPPVV
rpus) Bool -> PredicateFailure UPPVV -> Rule UPPVV 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure UPPVV
UppvvPredicateFailure
AlreadyProposedPv
        Map UpId (ProtVer, PParams)
-> F (Clause UPPVV 'Transition) (Map UpId (ProtVer, PParams))
forall (m :: * -> *) a. Monad m => a -> m a
return (Map UpId (ProtVer, PParams)
 -> F (Clause UPPVV 'Transition) (Map UpId (ProtVer, PParams)))
-> Map UpId (ProtVer, PParams)
-> F (Clause UPPVV 'Transition) (Map UpId (ProtVer, PParams))
forall a b. (a -> b) -> a -> b
$! Map UpId (ProtVer, PParams)
State UPPVV
rpus Map UpId (ProtVer, PParams)
-> [(Domain (Map UpId (ProtVer, PParams)),
     Range (Map UpId (ProtVer, PParams)))]
-> Map UpId (ProtVer, PParams)
forall m (f :: * -> *).
(Relation m, Ord (Domain m), Ord (Range m), Foldable f) =>
m -> f (Domain m, Range m) -> m
 [(UpId
pid, (ProtVer
nv, PParams
ppsn))]
    ]


-- | Update proposal validity
data UPV deriving ((forall x. UPV -> Rep UPV x)
-> (forall x. Rep UPV x -> UPV) -> Generic UPV
forall x. Rep UPV x -> UPV
forall x. UPV -> Rep UPV x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UPV x -> UPV
$cfrom :: forall x. UPV -> Rep UPV x
Generic, Typeable UPV
DataType
Typeable UPV
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> UPV -> c UPV)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UPV)
-> (UPV -> Constr)
-> (UPV -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UPV))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPV))
-> ((forall b. Data b => b -> b) -> UPV -> UPV)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPV -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPV -> r)
-> (forall u. (forall d. Data d => d -> u) -> UPV -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> UPV -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> UPV -> m UPV)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UPV -> m UPV)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UPV -> m UPV)
-> Data UPV
UPV -> DataType
UPV -> Constr
(forall b. Data b => b -> b) -> UPV -> UPV
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPV -> c UPV
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPV
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> UPV -> u
forall u. (forall d. Data d => d -> u) -> UPV -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPV -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPV -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UPV -> m UPV
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPV -> m UPV
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPV
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPV -> c UPV
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UPV)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPV)
$tUPV :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> UPV -> m UPV
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPV -> m UPV
gmapMp :: (forall d. Data d => d -> m d) -> UPV -> m UPV
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPV -> m UPV
gmapM :: (forall d. Data d => d -> m d) -> UPV -> m UPV
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UPV -> m UPV
gmapQi :: Int -> (forall d. Data d => d -> u) -> UPV -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> UPV -> u
gmapQ :: (forall d. Data d => d -> u) -> UPV -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> UPV -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPV -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPV -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPV -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPV -> r
gmapT :: (forall b. Data b => b -> b) -> UPV -> UPV
$cgmapT :: (forall b. Data b => b -> b) -> UPV -> UPV
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPV)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPV)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UPV)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UPV)
dataTypeOf :: UPV -> DataType
$cdataTypeOf :: UPV -> DataType
toConstr :: UPV -> Constr
$ctoConstr :: UPV -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPV
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPV
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPV -> c UPV
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPV -> c UPV
$cp1Data :: Typeable UPV
Data, Typeable)

-- | These `PredicateFailure`s are all throwable.
data UpvPredicateFailure
  = UPPVVFailure (PredicateFailure UPPVV)
  | UPSVVFailure (PredicateFailure UPSVV)
  | AVChangedInPVUpdate ApName ApVer (Maybe (ApVer, Slot, Metadata))
  | ParamsChangedInSVUpdate
  | PVChangedInSVUpdate
  deriving (UpvPredicateFailure -> UpvPredicateFailure -> Bool
(UpvPredicateFailure -> UpvPredicateFailure -> Bool)
-> (UpvPredicateFailure -> UpvPredicateFailure -> Bool)
-> Eq UpvPredicateFailure
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpvPredicateFailure -> UpvPredicateFailure -> Bool
$c/= :: UpvPredicateFailure -> UpvPredicateFailure -> Bool
== :: UpvPredicateFailure -> UpvPredicateFailure -> Bool
$c== :: UpvPredicateFailure -> UpvPredicateFailure -> Bool
Eq, Int -> UpvPredicateFailure -> ShowS
[UpvPredicateFailure] -> ShowS
UpvPredicateFailure -> String
(Int -> UpvPredicateFailure -> ShowS)
-> (UpvPredicateFailure -> String)
-> ([UpvPredicateFailure] -> ShowS)
-> Show UpvPredicateFailure
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpvPredicateFailure] -> ShowS
$cshowList :: [UpvPredicateFailure] -> ShowS
show :: UpvPredicateFailure -> String
$cshow :: UpvPredicateFailure -> String
showsPrec :: Int -> UpvPredicateFailure -> ShowS
$cshowsPrec :: Int -> UpvPredicateFailure -> ShowS
Show, Typeable UpvPredicateFailure
DataType
Constr
Typeable UpvPredicateFailure
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> UpvPredicateFailure
    -> c UpvPredicateFailure)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UpvPredicateFailure)
-> (UpvPredicateFailure -> Constr)
-> (UpvPredicateFailure -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UpvPredicateFailure))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c UpvPredicateFailure))
-> ((forall b. Data b => b -> b)
    -> UpvPredicateFailure -> UpvPredicateFailure)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> UpvPredicateFailure -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> UpvPredicateFailure -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> UpvPredicateFailure -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> UpvPredicateFailure -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> UpvPredicateFailure -> m UpvPredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UpvPredicateFailure -> m UpvPredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UpvPredicateFailure -> m UpvPredicateFailure)
-> Data UpvPredicateFailure
UpvPredicateFailure -> DataType
UpvPredicateFailure -> Constr
(forall b. Data b => b -> b)
-> UpvPredicateFailure -> UpvPredicateFailure
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpvPredicateFailure
-> c UpvPredicateFailure
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpvPredicateFailure
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> UpvPredicateFailure -> u
forall u.
(forall d. Data d => d -> u) -> UpvPredicateFailure -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpvPredicateFailure -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpvPredicateFailure -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UpvPredicateFailure -> m UpvPredicateFailure
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpvPredicateFailure -> m UpvPredicateFailure
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpvPredicateFailure
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpvPredicateFailure
-> c UpvPredicateFailure
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UpvPredicateFailure)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpvPredicateFailure)
$cPVChangedInSVUpdate :: Constr
$cParamsChangedInSVUpdate :: Constr
$cAVChangedInPVUpdate :: Constr
$cUPSVVFailure :: Constr
$cUPPVVFailure :: Constr
$tUpvPredicateFailure :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> UpvPredicateFailure -> m UpvPredicateFailure
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpvPredicateFailure -> m UpvPredicateFailure
gmapMp :: (forall d. Data d => d -> m d)
-> UpvPredicateFailure -> m UpvPredicateFailure
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpvPredicateFailure -> m UpvPredicateFailure
gmapM :: (forall d. Data d => d -> m d)
-> UpvPredicateFailure -> m UpvPredicateFailure
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UpvPredicateFailure -> m UpvPredicateFailure
gmapQi :: Int -> (forall d. Data d => d -> u) -> UpvPredicateFailure -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> UpvPredicateFailure -> u
gmapQ :: (forall d. Data d => d -> u) -> UpvPredicateFailure -> [u]
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> UpvPredicateFailure -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpvPredicateFailure -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpvPredicateFailure -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpvPredicateFailure -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpvPredicateFailure -> r
gmapT :: (forall b. Data b => b -> b)
-> UpvPredicateFailure -> UpvPredicateFailure
$cgmapT :: (forall b. Data b => b -> b)
-> UpvPredicateFailure -> UpvPredicateFailure
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpvPredicateFailure)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpvPredicateFailure)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UpvPredicateFailure)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UpvPredicateFailure)
dataTypeOf :: UpvPredicateFailure -> DataType
$cdataTypeOf :: UpvPredicateFailure -> DataType
toConstr :: UpvPredicateFailure -> Constr
$ctoConstr :: UpvPredicateFailure -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpvPredicateFailure
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpvPredicateFailure
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpvPredicateFailure
-> c UpvPredicateFailure
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpvPredicateFailure
-> c UpvPredicateFailure
$cp1Data :: Typeable UpvPredicateFailure
Data, Typeable, (forall x. UpvPredicateFailure -> Rep UpvPredicateFailure x)
-> (forall x. Rep UpvPredicateFailure x -> UpvPredicateFailure)
-> Generic UpvPredicateFailure
forall x. Rep UpvPredicateFailure x -> UpvPredicateFailure
forall x. UpvPredicateFailure -> Rep UpvPredicateFailure x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpvPredicateFailure x -> UpvPredicateFailure
$cfrom :: forall x. UpvPredicateFailure -> Rep UpvPredicateFailure x
Generic, Context -> UpvPredicateFailure -> IO (Maybe ThunkInfo)
Proxy UpvPredicateFailure -> String
(Context -> UpvPredicateFailure -> IO (Maybe ThunkInfo))
-> (Context -> UpvPredicateFailure -> IO (Maybe ThunkInfo))
-> (Proxy UpvPredicateFailure -> String)
-> NoThunks UpvPredicateFailure
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy UpvPredicateFailure -> String
$cshowTypeOf :: Proxy UpvPredicateFailure -> String
wNoThunks :: Context -> UpvPredicateFailure -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> UpvPredicateFailure -> IO (Maybe ThunkInfo)
noThunks :: Context -> UpvPredicateFailure -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> UpvPredicateFailure -> IO (Maybe ThunkInfo)
NoThunks)

instance STS UPV where
  type Environment UPV =
    ( ProtVer
    , PParams
    , Map ApName (ApVer, Core.Slot, Metadata)
    )

  type State UPV =
    ( Map UpId (ProtVer, PParams)
    , Map UpId (ApName, ApVer, Metadata)
    )

  type Signal UPV = UProp
  type PredicateFailure UPV = UpvPredicateFailure


  initialRules :: [InitialRule UPV]
initialRules = []
  transitionRules :: [TransitionRule UPV]
transitionRules =
    [ do
        TRC ( (pv, pps, avs)
            , (rpus, raus)
            , Signal UPV
up
            ) <- F (Clause UPV 'Transition) (TRC UPV)
forall sts (rtype :: RuleType).
Rule sts rtype (RuleContext rtype sts)
judgmentContext
        Map UpId (ProtVer, PParams)
rpus' <- forall sub super (rtype :: RuleType).
Embed sub super =>
RuleContext rtype sub -> Rule super rtype (State sub)
forall super (rtype :: RuleType).
Embed UPPVV super =>
RuleContext rtype UPPVV -> Rule super rtype (State UPPVV)
trans @UPPVV (RuleContext 'Transition UPPVV
 -> Rule UPV 'Transition (State UPPVV))
-> RuleContext 'Transition UPPVV
-> Rule UPV 'Transition (State UPPVV)
forall a b. (a -> b) -> a -> b
$ (Environment UPPVV, State UPPVV, Signal UPPVV) -> TRC UPPVV
forall sts. (Environment sts, State sts, Signal sts) -> TRC sts
TRC ((ProtVer
pv, PParams
pps), Map UpId (ProtVer, PParams)
State UPPVV
rpus, Signal UPV
Signal UPPVV
up)
        let SwVer ApName
an ApVer
av = Signal UPV
UProp
up UProp -> Getting SwVer UProp SwVer -> SwVer
forall s a. s -> Getting a s a -> a
^. Getting SwVer UProp SwVer
Lens' UProp SwVer
upSwVer
        ApName -> ApVer -> Map ApName ApVer -> Bool
forall key v. (Ord key, Eq v) => key -> v -> Map key v -> Bool
inMap ApName
an ApVer
av ((ApVer, Slot, Metadata) -> ApVer
forall a b c. (a, b, c) -> a
swVer ((ApVer, Slot, Metadata) -> ApVer)
-> Map ApName (ApVer, Slot, Metadata) -> Map ApName ApVer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Map ApName (ApVer, Slot, Metadata)
avs) Bool -> PredicateFailure UPV -> Rule UPV 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! ApName
-> ApVer -> Maybe (ApVer, Slot, Metadata) -> UpvPredicateFailure
AVChangedInPVUpdate ApName
an ApVer
av (ApName
-> Map ApName (ApVer, Slot, Metadata)
-> Maybe (ApVer, Slot, Metadata)
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup ApName
an Map ApName (ApVer, Slot, Metadata)
avs)
        (Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata))
-> F (Clause UPV 'Transition)
     (Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata))
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata))
 -> F (Clause UPV 'Transition)
      (Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata)))
-> (Map UpId (ProtVer, PParams),
    Map UpId (ApName, ApVer, Metadata))
-> F (Clause UPV 'Transition)
     (Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata))
forall a b. (a -> b) -> a -> b
$! (Map UpId (ProtVer, PParams)
rpus', Map UpId (ApName, ApVer, Metadata)
raus)
    , do
        TRC ( (pv, pps, avs)
            , (rpus, raus)
            , Signal UPV
up
            ) <- F (Clause UPV 'Transition) (TRC UPV)
forall sts (rtype :: RuleType).
Rule sts rtype (RuleContext rtype sts)
judgmentContext
        ProtVer
pv ProtVer -> ProtVer -> Bool
forall a. Eq a => a -> a -> Bool
== Signal UPV
UProp
up UProp -> Getting ProtVer UProp ProtVer -> ProtVer
forall s a. s -> Getting a s a -> a
^. Getting ProtVer UProp ProtVer
Lens' UProp ProtVer
upPV Bool -> PredicateFailure UPV -> Rule UPV 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure UPV
UpvPredicateFailure
PVChangedInSVUpdate
        Signal UPV
UProp
up UProp -> Getting PParams UProp PParams -> PParams
forall s a. s -> Getting a s a -> a
^. Getting PParams UProp PParams
Lens' UProp PParams
upParams PParams -> PParams -> Bool
forall a. Eq a => a -> a -> Bool
== PParams
pps Bool -> PredicateFailure UPV -> Rule UPV 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure UPV
UpvPredicateFailure
ParamsChangedInSVUpdate
        Map UpId (ApName, ApVer, Metadata)
raus' <- forall sub super (rtype :: RuleType).
Embed sub super =>
RuleContext rtype sub -> Rule super rtype (State sub)
forall super (rtype :: RuleType).
Embed UPSVV super =>
RuleContext rtype UPSVV -> Rule super rtype (State UPSVV)
trans @UPSVV (RuleContext 'Transition UPSVV
 -> Rule UPV 'Transition (State UPSVV))
-> RuleContext 'Transition UPSVV
-> Rule UPV 'Transition (State UPSVV)
forall a b. (a -> b) -> a -> b
$ (Environment UPSVV, State UPSVV, Signal UPSVV) -> TRC UPSVV
forall sts. (Environment sts, State sts, Signal sts) -> TRC sts
TRC (Map ApName (ApVer, Slot, Metadata)
Environment UPSVV
avs, Map UpId (ApName, ApVer, Metadata)
State UPSVV
raus, Signal UPV
Signal UPSVV
up)
        (Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata))
-> F (Clause UPV 'Transition)
     (Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata))
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata))
 -> F (Clause UPV 'Transition)
      (Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata)))
-> (Map UpId (ProtVer, PParams),
    Map UpId (ApName, ApVer, Metadata))
-> F (Clause UPV 'Transition)
     (Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata))
forall a b. (a -> b) -> a -> b
$! (Map UpId (ProtVer, PParams)
rpus, Map UpId (ApName, ApVer, Metadata)
raus')
    , do
        TRC ( (pv, pps, avs)
            , (rpus, raus)
            , Signal UPV
up
            ) <- F (Clause UPV 'Transition) (TRC UPV)
forall sts (rtype :: RuleType).
Rule sts rtype (RuleContext rtype sts)
judgmentContext
        Map UpId (ProtVer, PParams)
rpus' <- forall sub super (rtype :: RuleType).
Embed sub super =>
RuleContext rtype sub -> Rule super rtype (State sub)
forall super (rtype :: RuleType).
Embed UPPVV super =>
RuleContext rtype UPPVV -> Rule super rtype (State UPPVV)
trans @UPPVV (RuleContext 'Transition UPPVV
 -> Rule UPV 'Transition (State UPPVV))
-> RuleContext 'Transition UPPVV
-> Rule UPV 'Transition (State UPPVV)
forall a b. (a -> b) -> a -> b
$ (Environment UPPVV, State UPPVV, Signal UPPVV) -> TRC UPPVV
forall sts. (Environment sts, State sts, Signal sts) -> TRC sts
TRC ((ProtVer
pv, PParams
pps), Map UpId (ProtVer, PParams)
State UPPVV
rpus, Signal UPV
Signal UPPVV
up)
        Map UpId (ApName, ApVer, Metadata)
raus' <- forall sub super (rtype :: RuleType).
Embed sub super =>
RuleContext rtype sub -> Rule super rtype (State sub)
forall super (rtype :: RuleType).
Embed UPSVV super =>
RuleContext rtype UPSVV -> Rule super rtype (State UPSVV)
trans @UPSVV (RuleContext 'Transition UPSVV
 -> Rule UPV 'Transition (State UPSVV))
-> RuleContext 'Transition UPSVV
-> Rule UPV 'Transition (State UPSVV)
forall a b. (a -> b) -> a -> b
$ (Environment UPSVV, State UPSVV, Signal UPSVV) -> TRC UPSVV
forall sts. (Environment sts, State sts, Signal sts) -> TRC sts
TRC (Map ApName (ApVer, Slot, Metadata)
Environment UPSVV
avs, Map UpId (ApName, ApVer, Metadata)
State UPSVV
raus, Signal UPV
Signal UPSVV
up)
        (Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata))
-> F (Clause UPV 'Transition)
     (Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata))
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata))
 -> F (Clause UPV 'Transition)
      (Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata)))
-> (Map UpId (ProtVer, PParams),
    Map UpId (ApName, ApVer, Metadata))
-> F (Clause UPV 'Transition)
     (Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata))
forall a b. (a -> b) -> a -> b
$! (Map UpId (ProtVer, PParams)
rpus', Map UpId (ApName, ApVer, Metadata)
raus')
    ]
    where
      swVer :: (a, b, c) -> a
swVer (a
x, b
_, c
_) = a
x

instance Embed UPPVV UPV where
  wrapFailed :: PredicateFailure UPPVV -> PredicateFailure UPV
wrapFailed = PredicateFailure UPPVV -> PredicateFailure UPV
PredicateFailure UPPVV -> UpvPredicateFailure
UPPVVFailure

instance Embed UPSVV UPV where
  wrapFailed :: PredicateFailure UPSVV -> PredicateFailure UPV
wrapFailed = PredicateFailure UPSVV -> PredicateFailure UPV
PredicateFailure UPSVV -> UpvPredicateFailure
UPSVVFailure

data UPREG deriving ((forall x. UPREG -> Rep UPREG x)
-> (forall x. Rep UPREG x -> UPREG) -> Generic UPREG
forall x. Rep UPREG x -> UPREG
forall x. UPREG -> Rep UPREG x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UPREG x -> UPREG
$cfrom :: forall x. UPREG -> Rep UPREG x
Generic, Typeable UPREG
DataType
Typeable UPREG
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> UPREG -> c UPREG)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UPREG)
-> (UPREG -> Constr)
-> (UPREG -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UPREG))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPREG))
-> ((forall b. Data b => b -> b) -> UPREG -> UPREG)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPREG -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPREG -> r)
-> (forall u. (forall d. Data d => d -> u) -> UPREG -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> UPREG -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> UPREG -> m UPREG)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UPREG -> m UPREG)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UPREG -> m UPREG)
-> Data UPREG
UPREG -> DataType
UPREG -> Constr
(forall b. Data b => b -> b) -> UPREG -> UPREG
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPREG -> c UPREG
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPREG
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> UPREG -> u
forall u. (forall d. Data d => d -> u) -> UPREG -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPREG -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPREG -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UPREG -> m UPREG
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPREG -> m UPREG
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPREG
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPREG -> c UPREG
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UPREG)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPREG)
$tUPREG :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> UPREG -> m UPREG
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPREG -> m UPREG
gmapMp :: (forall d. Data d => d -> m d) -> UPREG -> m UPREG
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPREG -> m UPREG
gmapM :: (forall d. Data d => d -> m d) -> UPREG -> m UPREG
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UPREG -> m UPREG
gmapQi :: Int -> (forall d. Data d => d -> u) -> UPREG -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> UPREG -> u
gmapQ :: (forall d. Data d => d -> u) -> UPREG -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> UPREG -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPREG -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPREG -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPREG -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPREG -> r
gmapT :: (forall b. Data b => b -> b) -> UPREG -> UPREG
$cgmapT :: (forall b. Data b => b -> b) -> UPREG -> UPREG
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPREG)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPREG)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UPREG)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UPREG)
dataTypeOf :: UPREG -> DataType
$cdataTypeOf :: UPREG -> DataType
toConstr :: UPREG -> Constr
$ctoConstr :: UPREG -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPREG
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPREG
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPREG -> c UPREG
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPREG -> c UPREG
$cp1Data :: Typeable UPREG
Data, Typeable)
-- | These `PredicateFailure`s are all throwable.
data UpregPredicateFailure
  = UPVFailure (PredicateFailure UPV)
  | NotGenesisDelegate
  | DoesNotVerify
  deriving (UpregPredicateFailure -> UpregPredicateFailure -> Bool
(UpregPredicateFailure -> UpregPredicateFailure -> Bool)
-> (UpregPredicateFailure -> UpregPredicateFailure -> Bool)
-> Eq UpregPredicateFailure
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpregPredicateFailure -> UpregPredicateFailure -> Bool
$c/= :: UpregPredicateFailure -> UpregPredicateFailure -> Bool
== :: UpregPredicateFailure -> UpregPredicateFailure -> Bool
$c== :: UpregPredicateFailure -> UpregPredicateFailure -> Bool
Eq, Int -> UpregPredicateFailure -> ShowS
[UpregPredicateFailure] -> ShowS
UpregPredicateFailure -> String
(Int -> UpregPredicateFailure -> ShowS)
-> (UpregPredicateFailure -> String)
-> ([UpregPredicateFailure] -> ShowS)
-> Show UpregPredicateFailure
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpregPredicateFailure] -> ShowS
$cshowList :: [UpregPredicateFailure] -> ShowS
show :: UpregPredicateFailure -> String
$cshow :: UpregPredicateFailure -> String
showsPrec :: Int -> UpregPredicateFailure -> ShowS
$cshowsPrec :: Int -> UpregPredicateFailure -> ShowS
Show, Typeable UpregPredicateFailure
DataType
Constr
Typeable UpregPredicateFailure
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> UpregPredicateFailure
    -> c UpregPredicateFailure)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UpregPredicateFailure)
-> (UpregPredicateFailure -> Constr)
-> (UpregPredicateFailure -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UpregPredicateFailure))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c UpregPredicateFailure))
-> ((forall b. Data b => b -> b)
    -> UpregPredicateFailure -> UpregPredicateFailure)
-> (forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> UpregPredicateFailure
    -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> UpregPredicateFailure
    -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> UpregPredicateFailure -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> UpregPredicateFailure -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> UpregPredicateFailure -> m UpregPredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UpregPredicateFailure -> m UpregPredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UpregPredicateFailure -> m UpregPredicateFailure)
-> Data UpregPredicateFailure
UpregPredicateFailure -> DataType
UpregPredicateFailure -> Constr
(forall b. Data b => b -> b)
-> UpregPredicateFailure -> UpregPredicateFailure
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpregPredicateFailure
-> c UpregPredicateFailure
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpregPredicateFailure
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> UpregPredicateFailure -> u
forall u.
(forall d. Data d => d -> u) -> UpregPredicateFailure -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpregPredicateFailure -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpregPredicateFailure -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UpregPredicateFailure -> m UpregPredicateFailure
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpregPredicateFailure -> m UpregPredicateFailure
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpregPredicateFailure
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpregPredicateFailure
-> c UpregPredicateFailure
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UpregPredicateFailure)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpregPredicateFailure)
$cDoesNotVerify :: Constr
$cNotGenesisDelegate :: Constr
$cUPVFailure :: Constr
$tUpregPredicateFailure :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> UpregPredicateFailure -> m UpregPredicateFailure
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpregPredicateFailure -> m UpregPredicateFailure
gmapMp :: (forall d. Data d => d -> m d)
-> UpregPredicateFailure -> m UpregPredicateFailure
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpregPredicateFailure -> m UpregPredicateFailure
gmapM :: (forall d. Data d => d -> m d)
-> UpregPredicateFailure -> m UpregPredicateFailure
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UpregPredicateFailure -> m UpregPredicateFailure
gmapQi :: Int -> (forall d. Data d => d -> u) -> UpregPredicateFailure -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> UpregPredicateFailure -> u
gmapQ :: (forall d. Data d => d -> u) -> UpregPredicateFailure -> [u]
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> UpregPredicateFailure -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpregPredicateFailure -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpregPredicateFailure -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpregPredicateFailure -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpregPredicateFailure -> r
gmapT :: (forall b. Data b => b -> b)
-> UpregPredicateFailure -> UpregPredicateFailure
$cgmapT :: (forall b. Data b => b -> b)
-> UpregPredicateFailure -> UpregPredicateFailure
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpregPredicateFailure)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpregPredicateFailure)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UpregPredicateFailure)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UpregPredicateFailure)
dataTypeOf :: UpregPredicateFailure -> DataType
$cdataTypeOf :: UpregPredicateFailure -> DataType
toConstr :: UpregPredicateFailure -> Constr
$ctoConstr :: UpregPredicateFailure -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpregPredicateFailure
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpregPredicateFailure
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpregPredicateFailure
-> c UpregPredicateFailure
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpregPredicateFailure
-> c UpregPredicateFailure
$cp1Data :: Typeable UpregPredicateFailure
Data, Typeable, (forall x. UpregPredicateFailure -> Rep UpregPredicateFailure x)
-> (forall x. Rep UpregPredicateFailure x -> UpregPredicateFailure)
-> Generic UpregPredicateFailure
forall x. Rep UpregPredicateFailure x -> UpregPredicateFailure
forall x. UpregPredicateFailure -> Rep UpregPredicateFailure x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpregPredicateFailure x -> UpregPredicateFailure
$cfrom :: forall x. UpregPredicateFailure -> Rep UpregPredicateFailure x
Generic, Context -> UpregPredicateFailure -> IO (Maybe ThunkInfo)
Proxy UpregPredicateFailure -> String
(Context -> UpregPredicateFailure -> IO (Maybe ThunkInfo))
-> (Context -> UpregPredicateFailure -> IO (Maybe ThunkInfo))
-> (Proxy UpregPredicateFailure -> String)
-> NoThunks UpregPredicateFailure
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy UpregPredicateFailure -> String
$cshowTypeOf :: Proxy UpregPredicateFailure -> String
wNoThunks :: Context -> UpregPredicateFailure -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> UpregPredicateFailure -> IO (Maybe ThunkInfo)
noThunks :: Context -> UpregPredicateFailure -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> UpregPredicateFailure -> IO (Maybe ThunkInfo)
NoThunks)

instance STS UPREG where
  type Environment UPREG =
    ( ProtVer
    , PParams
    , Map ApName (ApVer, Core.Slot, Metadata)
    , Bimap Core.VKeyGenesis Core.VKey
    )
  type State UPREG =
    ( Map UpId (ProtVer, PParams)
    , Map UpId (ApName, ApVer, Metadata)
    )
  type Signal UPREG = UProp
  type PredicateFailure UPREG = UpregPredicateFailure

  initialRules :: [InitialRule UPREG]
initialRules = []
  transitionRules :: [TransitionRule UPREG]
transitionRules =
    [ do
        TRC ( (pv, pps, avs, dms)
            , (rpus, raus)
            , Signal UPREG
up
            ) <- F (Clause UPREG 'Transition) (TRC UPREG)
forall sts (rtype :: RuleType).
Rule sts rtype (RuleContext rtype sts)
judgmentContext
        (Map UpId (ProtVer, PParams)
rpus', Map UpId (ApName, ApVer, Metadata)
raus') <- forall sub super (rtype :: RuleType).
Embed sub super =>
RuleContext rtype sub -> Rule super rtype (State sub)
forall super (rtype :: RuleType).
Embed UPV super =>
RuleContext rtype UPV -> Rule super rtype (State UPV)
trans @UPV (RuleContext 'Transition UPV -> Rule UPREG 'Transition (State UPV))
-> RuleContext 'Transition UPV
-> Rule UPREG 'Transition (State UPV)
forall a b. (a -> b) -> a -> b
$ (Environment UPV, State UPV, Signal UPV) -> TRC UPV
forall sts. (Environment sts, State sts, Signal sts) -> TRC sts
TRC ((ProtVer
pv, PParams
pps, Map ApName (ApVer, Slot, Metadata)
avs), (Map UpId (ProtVer, PParams)
rpus, Map UpId (ApName, ApVer, Metadata)
raus), Signal UPREG
Signal UPV
up)
        let vk :: VKey
vk = Signal UPREG
UProp
up UProp -> Getting VKey UProp VKey -> VKey
forall s a. s -> Getting a s a -> a
^. Getting VKey UProp VKey
Lens' UProp VKey
upIssuer
        Bimap VKeyGenesis VKey
dms Bimap VKeyGenesis VKey
-> Set (Range (Bimap VKeyGenesis VKey)) -> Bimap VKeyGenesis VKey
forall m. (Relation m, Ord (Range m)) => m -> Set (Range m) -> m
 VKey -> Set VKey
forall a. a -> Set a
Set.singleton VKey
vk Bimap VKeyGenesis VKey -> Bimap VKeyGenesis VKey -> Bool
forall a. Eq a => a -> a -> Bool
/= Bimap VKeyGenesis VKey
forall a b. Bimap a b
empty Bool -> PredicateFailure UPREG -> Rule UPREG 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure UPREG
UpregPredicateFailure
NotGenesisDelegate
        VKey -> UpSD -> Sig UpSD -> Bool
forall a. Eq a => VKey -> a -> Sig a -> Bool
Core.verify VKey
vk (Signal UPREG
UProp
up UProp -> Getting UpSD UProp UpSD -> UpSD
forall s a. s -> Getting a s a -> a
^. Getting UpSD UProp UpSD
Lens UProp UProp UpSD UpSD
upSigData) (Signal UPREG
UProp
up UProp -> Getting (Sig UpSD) UProp (Sig UpSD) -> Sig UpSD
forall s a. s -> Getting a s a -> a
^. Getting (Sig UpSD) UProp (Sig UpSD)
Lens' UProp (Sig UpSD)
upSig) Bool -> PredicateFailure UPREG -> Rule UPREG 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure UPREG
UpregPredicateFailure
DoesNotVerify
        (Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata))
-> F (Clause UPREG 'Transition)
     (Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata))
forall (m :: * -> *) a. Monad m => a -> m a
return ((Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata))
 -> F (Clause UPREG 'Transition)
      (Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata)))
-> (Map UpId (ProtVer, PParams),
    Map UpId (ApName, ApVer, Metadata))
-> F (Clause UPREG 'Transition)
     (Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata))
forall a b. (a -> b) -> a -> b
$! (Map UpId (ProtVer, PParams)
rpus', Map UpId (ApName, ApVer, Metadata)
raus')


    ]

instance Embed UPV UPREG where
  wrapFailed :: PredicateFailure UPV -> PredicateFailure UPREG
wrapFailed = PredicateFailure UPV -> PredicateFailure UPREG
PredicateFailure UPV -> UpregPredicateFailure
UPVFailure

------------------------------------------------------------------------
-- Update voting
------------------------------------------------------------------------

data Vote = Vote
  { Vote -> VKey
_vCaster :: Core.VKey
  , Vote -> UpId
_vPropId :: UpId
  , Vote -> Sig UpId
_vSig :: Core.Sig UpId
  } deriving (Vote -> Vote -> Bool
(Vote -> Vote -> Bool) -> (Vote -> Vote -> Bool) -> Eq Vote
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Vote -> Vote -> Bool
$c/= :: Vote -> Vote -> Bool
== :: Vote -> Vote -> Bool
$c== :: Vote -> Vote -> Bool
Eq, (forall x. Vote -> Rep Vote x)
-> (forall x. Rep Vote x -> Vote) -> Generic Vote
forall x. Rep Vote x -> Vote
forall x. Vote -> Rep Vote x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Vote x -> Vote
$cfrom :: forall x. Vote -> Rep Vote x
Generic, Int -> Vote -> ShowS
[Vote] -> ShowS
Vote -> String
(Int -> Vote -> ShowS)
-> (Vote -> String) -> ([Vote] -> ShowS) -> Show Vote
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Vote] -> ShowS
$cshowList :: [Vote] -> ShowS
show :: Vote -> String
$cshow :: Vote -> String
showsPrec :: Int -> Vote -> ShowS
$cshowsPrec :: Int -> Vote -> ShowS
Show, Int -> Vote -> Int
Vote -> Int
(Int -> Vote -> Int) -> (Vote -> Int) -> Hashable Vote
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: Vote -> Int
$chash :: Vote -> Int
hashWithSalt :: Int -> Vote -> Int
$chashWithSalt :: Int -> Vote -> Int
Hashable, Typeable Vote
DataType
Constr
Typeable Vote
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Vote -> c Vote)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Vote)
-> (Vote -> Constr)
-> (Vote -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Vote))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Vote))
-> ((forall b. Data b => b -> b) -> Vote -> Vote)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Vote -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Vote -> r)
-> (forall u. (forall d. Data d => d -> u) -> Vote -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Vote -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Vote -> m Vote)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Vote -> m Vote)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Vote -> m Vote)
-> Data Vote
Vote -> DataType
Vote -> Constr
(forall b. Data b => b -> b) -> Vote -> Vote
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Vote -> c Vote
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Vote
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Vote -> u
forall u. (forall d. Data d => d -> u) -> Vote -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Vote -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Vote -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Vote -> m Vote
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Vote -> m Vote
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Vote
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Vote -> c Vote
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Vote)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Vote)
$cVote :: Constr
$tVote :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Vote -> m Vote
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Vote -> m Vote
gmapMp :: (forall d. Data d => d -> m d) -> Vote -> m Vote
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Vote -> m Vote
gmapM :: (forall d. Data d => d -> m d) -> Vote -> m Vote
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Vote -> m Vote
gmapQi :: Int -> (forall d. Data d => d -> u) -> Vote -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Vote -> u
gmapQ :: (forall d. Data d => d -> u) -> Vote -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Vote -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Vote -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Vote -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Vote -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Vote -> r
gmapT :: (forall b. Data b => b -> b) -> Vote -> Vote
$cgmapT :: (forall b. Data b => b -> b) -> Vote -> Vote
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Vote)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Vote)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Vote)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Vote)
dataTypeOf :: Vote -> DataType
$cdataTypeOf :: Vote -> DataType
toConstr :: Vote -> Constr
$ctoConstr :: Vote -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Vote
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Vote
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Vote -> c Vote
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Vote -> c Vote
$cp1Data :: Typeable Vote
Data, Typeable, Context -> Vote -> IO (Maybe ThunkInfo)
Proxy Vote -> String
(Context -> Vote -> IO (Maybe ThunkInfo))
-> (Context -> Vote -> IO (Maybe ThunkInfo))
-> (Proxy Vote -> String)
-> NoThunks Vote
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy Vote -> String
$cshowTypeOf :: Proxy Vote -> String
wNoThunks :: Context -> Vote -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> Vote -> IO (Maybe ThunkInfo)
noThunks :: Context -> Vote -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> Vote -> IO (Maybe ThunkInfo)
NoThunks)


makeLenses ''Vote


instance HasTypeReps Vote


mkVote :: Core.VKey -> UpId -> Vote
mkVote :: VKey -> UpId -> Vote
mkVote VKey
caster UpId
proposalId
  = Vote :: VKey -> UpId -> Sig UpId -> Vote
Vote
  { _vCaster :: VKey
_vCaster = VKey
caster
  , _vPropId :: UpId
_vPropId = UpId
proposalId
  , _vSig :: Sig UpId
_vSig = SKey -> UpId -> Sig UpId
forall a. SKey -> a -> Sig a
Core.sign (VKey -> SKey
skey VKey
caster) UpId
proposalId
  }

instance HasHash (Maybe Byron.Spec.Ledger.Update.UProp, [Byron.Spec.Ledger.Update.Vote]) where
  hash :: (Maybe UProp, [Vote]) -> Hash
hash = Maybe Int -> Hash
Core.Hash (Maybe Int -> Hash)
-> ((Maybe UProp, [Vote]) -> Maybe Int)
-> (Maybe UProp, [Vote])
-> Hash
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Maybe Int
forall a. a -> Maybe a
Just (Int -> Maybe Int)
-> ((Maybe UProp, [Vote]) -> Int)
-> (Maybe UProp, [Vote])
-> Maybe Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe UProp, [Vote]) -> Int
forall a. Hashable a => a -> Int
H.hash


data ADDVOTE deriving ((forall x. ADDVOTE -> Rep ADDVOTE x)
-> (forall x. Rep ADDVOTE x -> ADDVOTE) -> Generic ADDVOTE
forall x. Rep ADDVOTE x -> ADDVOTE
forall x. ADDVOTE -> Rep ADDVOTE x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ADDVOTE x -> ADDVOTE
$cfrom :: forall x. ADDVOTE -> Rep ADDVOTE x
Generic, Typeable ADDVOTE
DataType
Typeable ADDVOTE
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ADDVOTE -> c ADDVOTE)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ADDVOTE)
-> (ADDVOTE -> Constr)
-> (ADDVOTE -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ADDVOTE))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ADDVOTE))
-> ((forall b. Data b => b -> b) -> ADDVOTE -> ADDVOTE)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ADDVOTE -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ADDVOTE -> r)
-> (forall u. (forall d. Data d => d -> u) -> ADDVOTE -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> ADDVOTE -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> ADDVOTE -> m ADDVOTE)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ADDVOTE -> m ADDVOTE)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ADDVOTE -> m ADDVOTE)
-> Data ADDVOTE
ADDVOTE -> DataType
ADDVOTE -> Constr
(forall b. Data b => b -> b) -> ADDVOTE -> ADDVOTE
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ADDVOTE -> c ADDVOTE
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ADDVOTE
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ADDVOTE -> u
forall u. (forall d. Data d => d -> u) -> ADDVOTE -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ADDVOTE -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ADDVOTE -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ADDVOTE -> m ADDVOTE
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ADDVOTE -> m ADDVOTE
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ADDVOTE
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ADDVOTE -> c ADDVOTE
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ADDVOTE)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ADDVOTE)
$tADDVOTE :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> ADDVOTE -> m ADDVOTE
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ADDVOTE -> m ADDVOTE
gmapMp :: (forall d. Data d => d -> m d) -> ADDVOTE -> m ADDVOTE
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ADDVOTE -> m ADDVOTE
gmapM :: (forall d. Data d => d -> m d) -> ADDVOTE -> m ADDVOTE
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ADDVOTE -> m ADDVOTE
gmapQi :: Int -> (forall d. Data d => d -> u) -> ADDVOTE -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ADDVOTE -> u
gmapQ :: (forall d. Data d => d -> u) -> ADDVOTE -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ADDVOTE -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ADDVOTE -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ADDVOTE -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ADDVOTE -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ADDVOTE -> r
gmapT :: (forall b. Data b => b -> b) -> ADDVOTE -> ADDVOTE
$cgmapT :: (forall b. Data b => b -> b) -> ADDVOTE -> ADDVOTE
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ADDVOTE)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ADDVOTE)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ADDVOTE)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ADDVOTE)
dataTypeOf :: ADDVOTE -> DataType
$cdataTypeOf :: ADDVOTE -> DataType
toConstr :: ADDVOTE -> Constr
$ctoConstr :: ADDVOTE -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ADDVOTE
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ADDVOTE
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ADDVOTE -> c ADDVOTE
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ADDVOTE -> c ADDVOTE
$cp1Data :: Typeable ADDVOTE
Data, Typeable)

-- | These `PredicateFailure`s are all throwable.
data AddvotePredicateFailure
  = AVSigDoesNotVerify
  | NoUpdateProposal UpId
  | VoteByNonGenesisDelegate VKey
  | RepeatVoteByGenesisDelegate VKey
  deriving (AddvotePredicateFailure -> AddvotePredicateFailure -> Bool
(AddvotePredicateFailure -> AddvotePredicateFailure -> Bool)
-> (AddvotePredicateFailure -> AddvotePredicateFailure -> Bool)
-> Eq AddvotePredicateFailure
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddvotePredicateFailure -> AddvotePredicateFailure -> Bool
$c/= :: AddvotePredicateFailure -> AddvotePredicateFailure -> Bool
== :: AddvotePredicateFailure -> AddvotePredicateFailure -> Bool
$c== :: AddvotePredicateFailure -> AddvotePredicateFailure -> Bool
Eq, Int -> AddvotePredicateFailure -> ShowS
[AddvotePredicateFailure] -> ShowS
AddvotePredicateFailure -> String
(Int -> AddvotePredicateFailure -> ShowS)
-> (AddvotePredicateFailure -> String)
-> ([AddvotePredicateFailure] -> ShowS)
-> Show AddvotePredicateFailure
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddvotePredicateFailure] -> ShowS
$cshowList :: [AddvotePredicateFailure] -> ShowS
show :: AddvotePredicateFailure -> String
$cshow :: AddvotePredicateFailure -> String
showsPrec :: Int -> AddvotePredicateFailure -> ShowS
$cshowsPrec :: Int -> AddvotePredicateFailure -> ShowS
Show, Typeable AddvotePredicateFailure
DataType
Constr
Typeable AddvotePredicateFailure
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> AddvotePredicateFailure
    -> c AddvotePredicateFailure)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AddvotePredicateFailure)
-> (AddvotePredicateFailure -> Constr)
-> (AddvotePredicateFailure -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c AddvotePredicateFailure))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c AddvotePredicateFailure))
-> ((forall b. Data b => b -> b)
    -> AddvotePredicateFailure -> AddvotePredicateFailure)
-> (forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> AddvotePredicateFailure
    -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> AddvotePredicateFailure
    -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> AddvotePredicateFailure -> [u])
-> (forall u.
    Int
    -> (forall d. Data d => d -> u) -> AddvotePredicateFailure -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> AddvotePredicateFailure -> m AddvotePredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> AddvotePredicateFailure -> m AddvotePredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> AddvotePredicateFailure -> m AddvotePredicateFailure)
-> Data AddvotePredicateFailure
AddvotePredicateFailure -> DataType
AddvotePredicateFailure -> Constr
(forall b. Data b => b -> b)
-> AddvotePredicateFailure -> AddvotePredicateFailure
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> AddvotePredicateFailure
-> c AddvotePredicateFailure
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AddvotePredicateFailure
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> AddvotePredicateFailure -> u
forall u.
(forall d. Data d => d -> u) -> AddvotePredicateFailure -> [u]
forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> AddvotePredicateFailure
-> r
forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> AddvotePredicateFailure
-> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> AddvotePredicateFailure -> m AddvotePredicateFailure
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> AddvotePredicateFailure -> m AddvotePredicateFailure
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AddvotePredicateFailure
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> AddvotePredicateFailure
-> c AddvotePredicateFailure
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c AddvotePredicateFailure)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c AddvotePredicateFailure)
$cRepeatVoteByGenesisDelegate :: Constr
$cVoteByNonGenesisDelegate :: Constr
$cNoUpdateProposal :: Constr
$cAVSigDoesNotVerify :: Constr
$tAddvotePredicateFailure :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> AddvotePredicateFailure -> m AddvotePredicateFailure
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> AddvotePredicateFailure -> m AddvotePredicateFailure
gmapMp :: (forall d. Data d => d -> m d)
-> AddvotePredicateFailure -> m AddvotePredicateFailure
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> AddvotePredicateFailure -> m AddvotePredicateFailure
gmapM :: (forall d. Data d => d -> m d)
-> AddvotePredicateFailure -> m AddvotePredicateFailure
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> AddvotePredicateFailure -> m AddvotePredicateFailure
gmapQi :: Int -> (forall d. Data d => d -> u) -> AddvotePredicateFailure -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> AddvotePredicateFailure -> u
gmapQ :: (forall d. Data d => d -> u) -> AddvotePredicateFailure -> [u]
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> AddvotePredicateFailure -> [u]
gmapQr :: (r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> AddvotePredicateFailure
-> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> AddvotePredicateFailure
-> r
gmapQl :: (r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> AddvotePredicateFailure
-> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> AddvotePredicateFailure
-> r
gmapT :: (forall b. Data b => b -> b)
-> AddvotePredicateFailure -> AddvotePredicateFailure
$cgmapT :: (forall b. Data b => b -> b)
-> AddvotePredicateFailure -> AddvotePredicateFailure
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c AddvotePredicateFailure)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c AddvotePredicateFailure)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c AddvotePredicateFailure)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c AddvotePredicateFailure)
dataTypeOf :: AddvotePredicateFailure -> DataType
$cdataTypeOf :: AddvotePredicateFailure -> DataType
toConstr :: AddvotePredicateFailure -> Constr
$ctoConstr :: AddvotePredicateFailure -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AddvotePredicateFailure
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c AddvotePredicateFailure
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> AddvotePredicateFailure
-> c AddvotePredicateFailure
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> AddvotePredicateFailure
-> c AddvotePredicateFailure
$cp1Data :: Typeable AddvotePredicateFailure
Data, Typeable, (forall x.
 AddvotePredicateFailure -> Rep AddvotePredicateFailure x)
-> (forall x.
    Rep AddvotePredicateFailure x -> AddvotePredicateFailure)
-> Generic AddvotePredicateFailure
forall x. Rep AddvotePredicateFailure x -> AddvotePredicateFailure
forall x. AddvotePredicateFailure -> Rep AddvotePredicateFailure x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddvotePredicateFailure x -> AddvotePredicateFailure
$cfrom :: forall x. AddvotePredicateFailure -> Rep AddvotePredicateFailure x
Generic, Context -> AddvotePredicateFailure -> IO (Maybe ThunkInfo)
Proxy AddvotePredicateFailure -> String
(Context -> AddvotePredicateFailure -> IO (Maybe ThunkInfo))
-> (Context -> AddvotePredicateFailure -> IO (Maybe ThunkInfo))
-> (Proxy AddvotePredicateFailure -> String)
-> NoThunks AddvotePredicateFailure
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy AddvotePredicateFailure -> String
$cshowTypeOf :: Proxy AddvotePredicateFailure -> String
wNoThunks :: Context -> AddvotePredicateFailure -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> AddvotePredicateFailure -> IO (Maybe ThunkInfo)
noThunks :: Context -> AddvotePredicateFailure -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> AddvotePredicateFailure -> IO (Maybe ThunkInfo)
NoThunks)

instance STS ADDVOTE where
  type Environment ADDVOTE =
    ( Set UpId
    , Bimap Core.VKeyGenesis Core.VKey
    )
  type State ADDVOTE = Set (UpId, Core.VKeyGenesis)
  type Signal ADDVOTE = Vote
  type PredicateFailure ADDVOTE = AddvotePredicateFailure

  initialRules :: [InitialRule ADDVOTE]
initialRules = []
  transitionRules :: [TransitionRule ADDVOTE]
transitionRules =
    [ do
        TRC ( (rups, dms)
            , State ADDVOTE
vts
            , Signal ADDVOTE
vote
            ) <- F (Clause ADDVOTE 'Transition) (TRC ADDVOTE)
forall sts (rtype :: RuleType).
Rule sts rtype (RuleContext rtype sts)
judgmentContext
        let pid :: UpId
pid = Signal ADDVOTE
Vote
vote Vote -> Getting UpId Vote UpId -> UpId
forall s a. s -> Getting a s a -> a
^. Getting UpId Vote UpId
Lens' Vote UpId
vPropId
            vk :: VKey
vk = Signal ADDVOTE
Vote
vote Vote -> Getting VKey Vote VKey -> VKey
forall s a. s -> Getting a s a -> a
^. Getting VKey Vote VKey
Lens' Vote VKey
vCaster
            vtsPid :: Set (UpId, VKeyGenesis)
vtsPid =
              case VKey -> Bimap VKeyGenesis VKey -> Maybe VKeyGenesis
forall a b (m :: * -> *).
(Ord a, Ord b, MonadThrow m) =>
b -> Bimap a b -> m a
lookupR VKey
vk Bimap VKeyGenesis VKey
dms of
                Just VKeyGenesis
vks -> (UpId, VKeyGenesis) -> Set (UpId, VKeyGenesis)
forall a. a -> Set a
Set.singleton (UpId
pid, VKeyGenesis
vks)
                Maybe VKeyGenesis
Nothing  -> Set (UpId, VKeyGenesis)
forall a. Set a
Set.empty
        Set (UpId, VKeyGenesis)
vtsPid Set (UpId, VKeyGenesis) -> Set (UpId, VKeyGenesis) -> Bool
forall a. Eq a => a -> a -> Bool
/= Set (UpId, VKeyGenesis)
forall a. Set a
Set.empty Bool -> PredicateFailure ADDVOTE -> Rule ADDVOTE 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! VKey -> AddvotePredicateFailure
VoteByNonGenesisDelegate VKey
vk
        Bool -> Bool
not (Set (UpId, VKeyGenesis)
vtsPid Set (UpId, VKeyGenesis) -> Set (UpId, VKeyGenesis) -> Bool
forall a. Ord a => Set a -> Set a -> Bool
`Set.isSubsetOf` Set (UpId, VKeyGenesis)
State ADDVOTE
vts) Bool -> PredicateFailure ADDVOTE -> Rule ADDVOTE 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! VKey -> AddvotePredicateFailure
RepeatVoteByGenesisDelegate VKey
vk
        UpId -> Set UpId -> Bool
forall a. Ord a => a -> Set a -> Bool
Set.member UpId
pid Set UpId
rups Bool -> PredicateFailure ADDVOTE -> Rule ADDVOTE 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! UpId -> AddvotePredicateFailure
NoUpdateProposal UpId
pid
        VKey -> UpId -> Sig UpId -> Bool
forall a. Eq a => VKey -> a -> Sig a -> Bool
Core.verify VKey
vk UpId
pid (Signal ADDVOTE
Vote
vote Vote -> Getting (Sig UpId) Vote (Sig UpId) -> Sig UpId
forall s a. s -> Getting a s a -> a
^. Getting (Sig UpId) Vote (Sig UpId)
Lens' Vote (Sig UpId)
vSig) Bool -> PredicateFailure ADDVOTE -> Rule ADDVOTE 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure ADDVOTE
AddvotePredicateFailure
AVSigDoesNotVerify
        Set (UpId, VKeyGenesis)
-> F (Clause ADDVOTE 'Transition) (Set (UpId, VKeyGenesis))
forall (m :: * -> *) a. Monad m => a -> m a
return (Set (UpId, VKeyGenesis)
 -> F (Clause ADDVOTE 'Transition) (Set (UpId, VKeyGenesis)))
-> Set (UpId, VKeyGenesis)
-> F (Clause ADDVOTE 'Transition) (Set (UpId, VKeyGenesis))
forall a b. (a -> b) -> a -> b
$! Set (UpId, VKeyGenesis)
State ADDVOTE
vts Set (UpId, VKeyGenesis)
-> Set (UpId, VKeyGenesis) -> Set (UpId, VKeyGenesis)
forall a. Semigroup a => a -> a -> a
<> Set (UpId, VKeyGenesis)
vtsPid
    ]

data UPVOTE deriving ((forall x. UPVOTE -> Rep UPVOTE x)
-> (forall x. Rep UPVOTE x -> UPVOTE) -> Generic UPVOTE
forall x. Rep UPVOTE x -> UPVOTE
forall x. UPVOTE -> Rep UPVOTE x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UPVOTE x -> UPVOTE
$cfrom :: forall x. UPVOTE -> Rep UPVOTE x
Generic, Typeable UPVOTE
DataType
Typeable UPVOTE
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> UPVOTE -> c UPVOTE)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UPVOTE)
-> (UPVOTE -> Constr)
-> (UPVOTE -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UPVOTE))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPVOTE))
-> ((forall b. Data b => b -> b) -> UPVOTE -> UPVOTE)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> UPVOTE -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> UPVOTE -> r)
-> (forall u. (forall d. Data d => d -> u) -> UPVOTE -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> UPVOTE -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> UPVOTE -> m UPVOTE)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UPVOTE -> m UPVOTE)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UPVOTE -> m UPVOTE)
-> Data UPVOTE
UPVOTE -> DataType
UPVOTE -> Constr
(forall b. Data b => b -> b) -> UPVOTE -> UPVOTE
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPVOTE -> c UPVOTE
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPVOTE
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> UPVOTE -> u
forall u. (forall d. Data d => d -> u) -> UPVOTE -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPVOTE -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPVOTE -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UPVOTE -> m UPVOTE
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPVOTE -> m UPVOTE
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPVOTE
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPVOTE -> c UPVOTE
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UPVOTE)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPVOTE)
$tUPVOTE :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> UPVOTE -> m UPVOTE
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPVOTE -> m UPVOTE
gmapMp :: (forall d. Data d => d -> m d) -> UPVOTE -> m UPVOTE
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPVOTE -> m UPVOTE
gmapM :: (forall d. Data d => d -> m d) -> UPVOTE -> m UPVOTE
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UPVOTE -> m UPVOTE
gmapQi :: Int -> (forall d. Data d => d -> u) -> UPVOTE -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> UPVOTE -> u
gmapQ :: (forall d. Data d => d -> u) -> UPVOTE -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> UPVOTE -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPVOTE -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPVOTE -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPVOTE -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPVOTE -> r
gmapT :: (forall b. Data b => b -> b) -> UPVOTE -> UPVOTE
$cgmapT :: (forall b. Data b => b -> b) -> UPVOTE -> UPVOTE
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPVOTE)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPVOTE)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UPVOTE)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UPVOTE)
dataTypeOf :: UPVOTE -> DataType
$cdataTypeOf :: UPVOTE -> DataType
toConstr :: UPVOTE -> Constr
$ctoConstr :: UPVOTE -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPVOTE
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPVOTE
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPVOTE -> c UPVOTE
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPVOTE -> c UPVOTE
$cp1Data :: Typeable UPVOTE
Data, Typeable)

-- | The 3 non-embedded `PredicateFailure`s here are all structural. The
-- disjuntion of the preconditions is `True` - one rule either fires or the
-- other does.
data UpvotePredicateFailure
  = ADDVOTEFailure (PredicateFailure ADDVOTE)
  | S_HigherThanThdAndNotAlreadyConfirmed
  | S_CfmThdNotReached
  | S_AlreadyConfirmed
  deriving (UpvotePredicateFailure -> UpvotePredicateFailure -> Bool
(UpvotePredicateFailure -> UpvotePredicateFailure -> Bool)
-> (UpvotePredicateFailure -> UpvotePredicateFailure -> Bool)
-> Eq UpvotePredicateFailure
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpvotePredicateFailure -> UpvotePredicateFailure -> Bool
$c/= :: UpvotePredicateFailure -> UpvotePredicateFailure -> Bool
== :: UpvotePredicateFailure -> UpvotePredicateFailure -> Bool
$c== :: UpvotePredicateFailure -> UpvotePredicateFailure -> Bool
Eq, Int -> UpvotePredicateFailure -> ShowS
[UpvotePredicateFailure] -> ShowS
UpvotePredicateFailure -> String
(Int -> UpvotePredicateFailure -> ShowS)
-> (UpvotePredicateFailure -> String)
-> ([UpvotePredicateFailure] -> ShowS)
-> Show UpvotePredicateFailure
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpvotePredicateFailure] -> ShowS
$cshowList :: [UpvotePredicateFailure] -> ShowS
show :: UpvotePredicateFailure -> String
$cshow :: UpvotePredicateFailure -> String
showsPrec :: Int -> UpvotePredicateFailure -> ShowS
$cshowsPrec :: Int -> UpvotePredicateFailure -> ShowS
Show, Typeable UpvotePredicateFailure
DataType
Constr
Typeable UpvotePredicateFailure
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> UpvotePredicateFailure
    -> c UpvotePredicateFailure)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UpvotePredicateFailure)
-> (UpvotePredicateFailure -> Constr)
-> (UpvotePredicateFailure -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UpvotePredicateFailure))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c UpvotePredicateFailure))
-> ((forall b. Data b => b -> b)
    -> UpvotePredicateFailure -> UpvotePredicateFailure)
-> (forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> UpvotePredicateFailure
    -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> UpvotePredicateFailure
    -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> UpvotePredicateFailure -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> UpvotePredicateFailure -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> UpvotePredicateFailure -> m UpvotePredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UpvotePredicateFailure -> m UpvotePredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UpvotePredicateFailure -> m UpvotePredicateFailure)
-> Data UpvotePredicateFailure
UpvotePredicateFailure -> DataType
UpvotePredicateFailure -> Constr
(forall b. Data b => b -> b)
-> UpvotePredicateFailure -> UpvotePredicateFailure
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpvotePredicateFailure
-> c UpvotePredicateFailure
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpvotePredicateFailure
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> UpvotePredicateFailure -> u
forall u.
(forall d. Data d => d -> u) -> UpvotePredicateFailure -> [u]
forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpvotePredicateFailure
-> r
forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpvotePredicateFailure
-> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UpvotePredicateFailure -> m UpvotePredicateFailure
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpvotePredicateFailure -> m UpvotePredicateFailure
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpvotePredicateFailure
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpvotePredicateFailure
-> c UpvotePredicateFailure
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UpvotePredicateFailure)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpvotePredicateFailure)
$cS_AlreadyConfirmed :: Constr
$cS_CfmThdNotReached :: Constr
$cS_HigherThanThdAndNotAlreadyConfirmed :: Constr
$cADDVOTEFailure :: Constr
$tUpvotePredicateFailure :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> UpvotePredicateFailure -> m UpvotePredicateFailure
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpvotePredicateFailure -> m UpvotePredicateFailure
gmapMp :: (forall d. Data d => d -> m d)
-> UpvotePredicateFailure -> m UpvotePredicateFailure
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpvotePredicateFailure -> m UpvotePredicateFailure
gmapM :: (forall d. Data d => d -> m d)
-> UpvotePredicateFailure -> m UpvotePredicateFailure
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UpvotePredicateFailure -> m UpvotePredicateFailure
gmapQi :: Int -> (forall d. Data d => d -> u) -> UpvotePredicateFailure -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> UpvotePredicateFailure -> u
gmapQ :: (forall d. Data d => d -> u) -> UpvotePredicateFailure -> [u]
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> UpvotePredicateFailure -> [u]
gmapQr :: (r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpvotePredicateFailure
-> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpvotePredicateFailure
-> r
gmapQl :: (r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpvotePredicateFailure
-> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpvotePredicateFailure
-> r
gmapT :: (forall b. Data b => b -> b)
-> UpvotePredicateFailure -> UpvotePredicateFailure
$cgmapT :: (forall b. Data b => b -> b)
-> UpvotePredicateFailure -> UpvotePredicateFailure
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpvotePredicateFailure)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpvotePredicateFailure)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UpvotePredicateFailure)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UpvotePredicateFailure)
dataTypeOf :: UpvotePredicateFailure -> DataType
$cdataTypeOf :: UpvotePredicateFailure -> DataType
toConstr :: UpvotePredicateFailure -> Constr
$ctoConstr :: UpvotePredicateFailure -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpvotePredicateFailure
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpvotePredicateFailure
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpvotePredicateFailure
-> c UpvotePredicateFailure
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpvotePredicateFailure
-> c UpvotePredicateFailure
$cp1Data :: Typeable UpvotePredicateFailure
Data, (forall x. UpvotePredicateFailure -> Rep UpvotePredicateFailure x)
-> (forall x.
    Rep UpvotePredicateFailure x -> UpvotePredicateFailure)
-> Generic UpvotePredicateFailure
forall x. Rep UpvotePredicateFailure x -> UpvotePredicateFailure
forall x. UpvotePredicateFailure -> Rep UpvotePredicateFailure x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpvotePredicateFailure x -> UpvotePredicateFailure
$cfrom :: forall x. UpvotePredicateFailure -> Rep UpvotePredicateFailure x
Generic, Typeable, Context -> UpvotePredicateFailure -> IO (Maybe ThunkInfo)
Proxy UpvotePredicateFailure -> String
(Context -> UpvotePredicateFailure -> IO (Maybe ThunkInfo))
-> (Context -> UpvotePredicateFailure -> IO (Maybe ThunkInfo))
-> (Proxy UpvotePredicateFailure -> String)
-> NoThunks UpvotePredicateFailure
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy UpvotePredicateFailure -> String
$cshowTypeOf :: Proxy UpvotePredicateFailure -> String
wNoThunks :: Context -> UpvotePredicateFailure -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> UpvotePredicateFailure -> IO (Maybe ThunkInfo)
noThunks :: Context -> UpvotePredicateFailure -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> UpvotePredicateFailure -> IO (Maybe ThunkInfo)
NoThunks)

instance STS UPVOTE where
  type Environment UPVOTE =
    ( Core.Slot
    , Word8
    , Set UpId
    , Bimap Core.VKeyGenesis Core.VKey
    )
  type State UPVOTE =
    ( Map UpId Core.Slot
    , Set (UpId, Core.VKeyGenesis)
    )
  type Signal UPVOTE = Vote
  type PredicateFailure UPVOTE = UpvotePredicateFailure

  initialRules :: [InitialRule UPVOTE]
initialRules = []
  transitionRules :: [TransitionRule UPVOTE]
transitionRules =
    [ do
        TRC ( (_, t, rups, dms)
            , (cps, vts)
            , Signal UPVOTE
vote
            ) <- F (Clause UPVOTE 'Transition) (TRC UPVOTE)
forall sts (rtype :: RuleType).
Rule sts rtype (RuleContext rtype sts)
judgmentContext
        Set (UpId, VKeyGenesis)
vts' <- forall sub super (rtype :: RuleType).
Embed sub super =>
RuleContext rtype sub -> Rule super rtype (State sub)
forall super (rtype :: RuleType).
Embed ADDVOTE super =>
RuleContext rtype ADDVOTE -> Rule super rtype (State ADDVOTE)
trans @ADDVOTE (RuleContext 'Transition ADDVOTE
 -> Rule UPVOTE 'Transition (State ADDVOTE))
-> RuleContext 'Transition ADDVOTE
-> Rule UPVOTE 'Transition (State ADDVOTE)
forall a b. (a -> b) -> a -> b
$ (Environment ADDVOTE, State ADDVOTE, Signal ADDVOTE) -> TRC ADDVOTE
forall sts. (Environment sts, State sts, Signal sts) -> TRC sts
TRC ((Set UpId
rups, Bimap VKeyGenesis VKey
dms), Set (UpId, VKeyGenesis)
State ADDVOTE
vts, Signal UPVOTE
Signal ADDVOTE
vote)
        let pid :: UpId
pid = Signal UPVOTE
Vote
vote Vote -> Getting UpId Vote UpId -> UpId
forall s a. s -> Getting a s a -> a
^. Getting UpId Vote UpId
Lens' Vote UpId
vPropId
        Set (UpId, VKeyGenesis) -> Word8
forall m n. (Relation m, Integral n) => m -> n
size ([UpId
pid] [Domain (Set (UpId, VKeyGenesis))]
-> Set (UpId, VKeyGenesis) -> Set (UpId, VKeyGenesis)
forall m (f :: * -> *).
(Relation m, Ord (Domain m), Foldable f) =>
f (Domain m) -> m -> m
 Set (UpId, VKeyGenesis)
vts') Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
< Word8
t Bool -> Bool -> Bool
|| UpId
pid UpId -> Set UpId -> Bool
forall a (f :: * -> *). (Eq a, Foldable f) => a -> f a -> Bool
 Map UpId Slot -> Set (Domain (Map UpId Slot))
forall m. (Relation m, Ord (Domain m)) => m -> Set (Domain m)
dom Map UpId Slot
cps Bool -> PredicateFailure UPVOTE -> Rule UPVOTE 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure UPVOTE
UpvotePredicateFailure
S_HigherThanThdAndNotAlreadyConfirmed
        (Map UpId Slot, Set (UpId, VKeyGenesis))
-> F (Clause UPVOTE 'Transition)
     (Map UpId Slot, Set (UpId, VKeyGenesis))
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Map UpId Slot, Set (UpId, VKeyGenesis))
 -> F (Clause UPVOTE 'Transition)
      (Map UpId Slot, Set (UpId, VKeyGenesis)))
-> (Map UpId Slot, Set (UpId, VKeyGenesis))
-> F (Clause UPVOTE 'Transition)
     (Map UpId Slot, Set (UpId, VKeyGenesis))
forall a b. (a -> b) -> a -> b
$! ( Map UpId Slot
cps
                , Set (UpId, VKeyGenesis)
vts'
                )
    , do
        TRC ( (sn, t, rups, dms)
            , (cps, vts)
            , Signal UPVOTE
vote
            ) <- F (Clause UPVOTE 'Transition) (TRC UPVOTE)
forall sts (rtype :: RuleType).
Rule sts rtype (RuleContext rtype sts)
judgmentContext
        Set (UpId, VKeyGenesis)
vts' <- forall sub super (rtype :: RuleType).
Embed sub super =>
RuleContext rtype sub -> Rule super rtype (State sub)
forall super (rtype :: RuleType).
Embed ADDVOTE super =>
RuleContext rtype ADDVOTE -> Rule super rtype (State ADDVOTE)
trans @ADDVOTE (RuleContext 'Transition ADDVOTE
 -> Rule UPVOTE 'Transition (State ADDVOTE))
-> RuleContext 'Transition ADDVOTE
-> Rule UPVOTE 'Transition (State ADDVOTE)
forall a b. (a -> b) -> a -> b
$ (Environment ADDVOTE, State ADDVOTE, Signal ADDVOTE) -> TRC ADDVOTE
forall sts. (Environment sts, State sts, Signal sts) -> TRC sts
TRC ((Set UpId
rups, Bimap VKeyGenesis VKey
dms), Set (UpId, VKeyGenesis)
State ADDVOTE
vts, Signal UPVOTE
Signal ADDVOTE
vote)
        let pid :: UpId
pid = Signal UPVOTE
Vote
vote Vote -> Getting UpId Vote UpId -> UpId
forall s a. s -> Getting a s a -> a
^. Getting UpId Vote UpId
Lens' Vote UpId
vPropId
        Word8
t Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Set (UpId, VKeyGenesis) -> Word8
forall m n. (Relation m, Integral n) => m -> n
size ([UpId
pid] [Domain (Set (UpId, VKeyGenesis))]
-> Set (UpId, VKeyGenesis) -> Set (UpId, VKeyGenesis)
forall m (f :: * -> *).
(Relation m, Ord (Domain m), Foldable f) =>
f (Domain m) -> m -> m
 Set (UpId, VKeyGenesis)
vts') Bool -> PredicateFailure UPVOTE -> Rule UPVOTE 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure UPVOTE
UpvotePredicateFailure
S_CfmThdNotReached
        UpId
pid UpId -> Set UpId -> Bool
forall a (f :: * -> *). (Eq a, Foldable f) => a -> f a -> Bool
 Map UpId Slot -> Set (Domain (Map UpId Slot))
forall m. (Relation m, Ord (Domain m)) => m -> Set (Domain m)
dom Map UpId Slot
cps Bool -> PredicateFailure UPVOTE -> Rule UPVOTE 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure UPVOTE
UpvotePredicateFailure
S_AlreadyConfirmed
        (Map UpId Slot, Set (UpId, VKeyGenesis))
-> F (Clause UPVOTE 'Transition)
     (Map UpId Slot, Set (UpId, VKeyGenesis))
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Map UpId Slot, Set (UpId, VKeyGenesis))
 -> F (Clause UPVOTE 'Transition)
      (Map UpId Slot, Set (UpId, VKeyGenesis)))
-> (Map UpId Slot, Set (UpId, VKeyGenesis))
-> F (Clause UPVOTE 'Transition)
     (Map UpId Slot, Set (UpId, VKeyGenesis))
forall a b. (a -> b) -> a -> b
$! ( Map UpId Slot
cps Map UpId Slot
-> [(Domain (Map UpId Slot), Range (Map UpId Slot))]
-> Map UpId Slot
forall m (f :: * -> *).
(Relation m, Ord (Domain m), Ord (Range m), Foldable f) =>
m -> f (Domain m, Range m) -> m
 [(UpId
pid, Slot
sn)]
                , Set (UpId, VKeyGenesis)
vts'
                )

    ]

instance Embed ADDVOTE UPVOTE where
  wrapFailed :: PredicateFailure ADDVOTE -> PredicateFailure UPVOTE
wrapFailed = PredicateFailure ADDVOTE -> PredicateFailure UPVOTE
PredicateFailure ADDVOTE -> UpvotePredicateFailure
ADDVOTEFailure

------------------------------------------------------------------------
-- Update voting
------------------------------------------------------------------------

data FADS deriving ((forall x. FADS -> Rep FADS x)
-> (forall x. Rep FADS x -> FADS) -> Generic FADS
forall x. Rep FADS x -> FADS
forall x. FADS -> Rep FADS x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FADS x -> FADS
$cfrom :: forall x. FADS -> Rep FADS x
Generic, Typeable FADS
DataType
Typeable FADS
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> FADS -> c FADS)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c FADS)
-> (FADS -> Constr)
-> (FADS -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c FADS))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FADS))
-> ((forall b. Data b => b -> b) -> FADS -> FADS)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FADS -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FADS -> r)
-> (forall u. (forall d. Data d => d -> u) -> FADS -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> FADS -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> FADS -> m FADS)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FADS -> m FADS)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> FADS -> m FADS)
-> Data FADS
FADS -> DataType
FADS -> Constr
(forall b. Data b => b -> b) -> FADS -> FADS
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FADS -> c FADS
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FADS
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> FADS -> u
forall u. (forall d. Data d => d -> u) -> FADS -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FADS -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FADS -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FADS -> m FADS
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FADS -> m FADS
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FADS
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FADS -> c FADS
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FADS)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FADS)
$tFADS :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> FADS -> m FADS
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FADS -> m FADS
gmapMp :: (forall d. Data d => d -> m d) -> FADS -> m FADS
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FADS -> m FADS
gmapM :: (forall d. Data d => d -> m d) -> FADS -> m FADS
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FADS -> m FADS
gmapQi :: Int -> (forall d. Data d => d -> u) -> FADS -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FADS -> u
gmapQ :: (forall d. Data d => d -> u) -> FADS -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FADS -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FADS -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FADS -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FADS -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FADS -> r
gmapT :: (forall b. Data b => b -> b) -> FADS -> FADS
$cgmapT :: (forall b. Data b => b -> b) -> FADS -> FADS
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FADS)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FADS)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c FADS)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FADS)
dataTypeOf :: FADS -> DataType
$cdataTypeOf :: FADS -> DataType
toConstr :: FADS -> Constr
$ctoConstr :: FADS -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FADS
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FADS
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FADS -> c FADS
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FADS -> c FADS
$cp1Data :: Typeable FADS
Data, Typeable)

data FadsPredicateFailure
  deriving (FadsPredicateFailure -> FadsPredicateFailure -> Bool
(FadsPredicateFailure -> FadsPredicateFailure -> Bool)
-> (FadsPredicateFailure -> FadsPredicateFailure -> Bool)
-> Eq FadsPredicateFailure
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FadsPredicateFailure -> FadsPredicateFailure -> Bool
$c/= :: FadsPredicateFailure -> FadsPredicateFailure -> Bool
== :: FadsPredicateFailure -> FadsPredicateFailure -> Bool
$c== :: FadsPredicateFailure -> FadsPredicateFailure -> Bool
Eq, Int -> FadsPredicateFailure -> ShowS
[FadsPredicateFailure] -> ShowS
FadsPredicateFailure -> String
(Int -> FadsPredicateFailure -> ShowS)
-> (FadsPredicateFailure -> String)
-> ([FadsPredicateFailure] -> ShowS)
-> Show FadsPredicateFailure
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FadsPredicateFailure] -> ShowS
$cshowList :: [FadsPredicateFailure] -> ShowS
show :: FadsPredicateFailure -> String
$cshow :: FadsPredicateFailure -> String
showsPrec :: Int -> FadsPredicateFailure -> ShowS
$cshowsPrec :: Int -> FadsPredicateFailure -> ShowS
Show, Typeable FadsPredicateFailure
DataType
Typeable FadsPredicateFailure
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> FadsPredicateFailure
    -> c FadsPredicateFailure)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c FadsPredicateFailure)
-> (FadsPredicateFailure -> Constr)
-> (FadsPredicateFailure -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c FadsPredicateFailure))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c FadsPredicateFailure))
-> ((forall b. Data b => b -> b)
    -> FadsPredicateFailure -> FadsPredicateFailure)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> FadsPredicateFailure -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> FadsPredicateFailure -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> FadsPredicateFailure -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> FadsPredicateFailure -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> FadsPredicateFailure -> m FadsPredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> FadsPredicateFailure -> m FadsPredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> FadsPredicateFailure -> m FadsPredicateFailure)
-> Data FadsPredicateFailure
FadsPredicateFailure -> DataType
FadsPredicateFailure -> Constr
(forall b. Data b => b -> b)
-> FadsPredicateFailure -> FadsPredicateFailure
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> FadsPredicateFailure
-> c FadsPredicateFailure
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FadsPredicateFailure
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> FadsPredicateFailure -> u
forall u.
(forall d. Data d => d -> u) -> FadsPredicateFailure -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FadsPredicateFailure -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FadsPredicateFailure -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> FadsPredicateFailure -> m FadsPredicateFailure
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FadsPredicateFailure -> m FadsPredicateFailure
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FadsPredicateFailure
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> FadsPredicateFailure
-> c FadsPredicateFailure
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FadsPredicateFailure)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FadsPredicateFailure)
$tFadsPredicateFailure :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> FadsPredicateFailure -> m FadsPredicateFailure
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FadsPredicateFailure -> m FadsPredicateFailure
gmapMp :: (forall d. Data d => d -> m d)
-> FadsPredicateFailure -> m FadsPredicateFailure
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FadsPredicateFailure -> m FadsPredicateFailure
gmapM :: (forall d. Data d => d -> m d)
-> FadsPredicateFailure -> m FadsPredicateFailure
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> FadsPredicateFailure -> m FadsPredicateFailure
gmapQi :: Int -> (forall d. Data d => d -> u) -> FadsPredicateFailure -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> FadsPredicateFailure -> u
gmapQ :: (forall d. Data d => d -> u) -> FadsPredicateFailure -> [u]
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> FadsPredicateFailure -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FadsPredicateFailure -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FadsPredicateFailure -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FadsPredicateFailure -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FadsPredicateFailure -> r
gmapT :: (forall b. Data b => b -> b)
-> FadsPredicateFailure -> FadsPredicateFailure
$cgmapT :: (forall b. Data b => b -> b)
-> FadsPredicateFailure -> FadsPredicateFailure
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FadsPredicateFailure)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FadsPredicateFailure)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c FadsPredicateFailure)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FadsPredicateFailure)
dataTypeOf :: FadsPredicateFailure -> DataType
$cdataTypeOf :: FadsPredicateFailure -> DataType
toConstr :: FadsPredicateFailure -> Constr
$ctoConstr :: FadsPredicateFailure -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FadsPredicateFailure
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FadsPredicateFailure
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> FadsPredicateFailure
-> c FadsPredicateFailure
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> FadsPredicateFailure
-> c FadsPredicateFailure
$cp1Data :: Typeable FadsPredicateFailure
Data, Typeable, (forall x. FadsPredicateFailure -> Rep FadsPredicateFailure x)
-> (forall x. Rep FadsPredicateFailure x -> FadsPredicateFailure)
-> Generic FadsPredicateFailure
forall x. Rep FadsPredicateFailure x -> FadsPredicateFailure
forall x. FadsPredicateFailure -> Rep FadsPredicateFailure x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FadsPredicateFailure x -> FadsPredicateFailure
$cfrom :: forall x. FadsPredicateFailure -> Rep FadsPredicateFailure x
Generic)

instance STS FADS where
  type Environment FADS = ()
  type State FADS = [(Core.Slot, (ProtVer, PParams))]
  type Signal FADS = (Core.Slot, (ProtVer, PParams))
  type PredicateFailure FADS = FadsPredicateFailure

  initialRules :: [InitialRule FADS]
initialRules = []
  transitionRules :: [TransitionRule FADS]
transitionRules =
    [ do
        TRC ( ()
            , State FADS
fads
            , (sn, (bv, ppsc))
            ) <- F (Clause FADS 'Transition) (TRC FADS)
forall sts (rtype :: RuleType).
Rule sts rtype (RuleContext rtype sts)
judgmentContext
        [(Slot, (ProtVer, PParams))]
-> F (Clause FADS 'Transition) [(Slot, (ProtVer, PParams))]
forall (m :: * -> *) a. Monad m => a -> m a
return ([(Slot, (ProtVer, PParams))]
 -> F (Clause FADS 'Transition) [(Slot, (ProtVer, PParams))])
-> [(Slot, (ProtVer, PParams))]
-> F (Clause FADS 'Transition) [(Slot, (ProtVer, PParams))]
forall a b. (a -> b) -> a -> b
$ case State FADS
fads of
          ((_, (pvc, _)) : _ ) -> if ProtVer
pvc ProtVer -> ProtVer -> Bool
forall a. Ord a => a -> a -> Bool
< ProtVer
bv
            then (Slot
sn, (ProtVer
bv, PParams
ppsc)) (Slot, (ProtVer, PParams))
-> [(Slot, (ProtVer, PParams))] -> [(Slot, (ProtVer, PParams))]
forall a. a -> [a] -> [a]
: [(Slot, (ProtVer, PParams))]
State FADS
fads
            else [(Slot, (ProtVer, PParams))]
State FADS
fads
          State FADS
_ -> (Slot
sn, (ProtVer
bv, PParams
ppsc)) (Slot, (ProtVer, PParams))
-> [(Slot, (ProtVer, PParams))] -> [(Slot, (ProtVer, PParams))]
forall a. a -> [a] -> [a]
: [(Slot, (ProtVer, PParams))]
State FADS
fads
    ]

data UPEND deriving ((forall x. UPEND -> Rep UPEND x)
-> (forall x. Rep UPEND x -> UPEND) -> Generic UPEND
forall x. Rep UPEND x -> UPEND
forall x. UPEND -> Rep UPEND x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UPEND x -> UPEND
$cfrom :: forall x. UPEND -> Rep UPEND x
Generic, Typeable UPEND
DataType
Typeable UPEND
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> UPEND -> c UPEND)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UPEND)
-> (UPEND -> Constr)
-> (UPEND -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UPEND))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPEND))
-> ((forall b. Data b => b -> b) -> UPEND -> UPEND)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPEND -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPEND -> r)
-> (forall u. (forall d. Data d => d -> u) -> UPEND -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> UPEND -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> UPEND -> m UPEND)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UPEND -> m UPEND)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UPEND -> m UPEND)
-> Data UPEND
UPEND -> DataType
UPEND -> Constr
(forall b. Data b => b -> b) -> UPEND -> UPEND
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPEND -> c UPEND
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPEND
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> UPEND -> u
forall u. (forall d. Data d => d -> u) -> UPEND -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPEND -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPEND -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UPEND -> m UPEND
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPEND -> m UPEND
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPEND
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPEND -> c UPEND
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UPEND)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPEND)
$tUPEND :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> UPEND -> m UPEND
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPEND -> m UPEND
gmapMp :: (forall d. Data d => d -> m d) -> UPEND -> m UPEND
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPEND -> m UPEND
gmapM :: (forall d. Data d => d -> m d) -> UPEND -> m UPEND
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UPEND -> m UPEND
gmapQi :: Int -> (forall d. Data d => d -> u) -> UPEND -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> UPEND -> u
gmapQ :: (forall d. Data d => d -> u) -> UPEND -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> UPEND -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPEND -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPEND -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPEND -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPEND -> r
gmapT :: (forall b. Data b => b -> b) -> UPEND -> UPEND
$cgmapT :: (forall b. Data b => b -> b) -> UPEND -> UPEND
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPEND)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPEND)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UPEND)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UPEND)
dataTypeOf :: UPEND -> DataType
$cdataTypeOf :: UPEND -> DataType
toConstr :: UPEND -> Constr
$ctoConstr :: UPEND -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPEND
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPEND
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPEND -> c UPEND
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPEND -> c UPEND
$cp1Data :: Typeable UPEND
Data, Typeable)

-- | Find the key that corresponds to the value satisfying the given predicate.
-- In case zero or more than one key is found this function returns Nothing.
findKey :: (v -> Bool) -> Map k v -> Maybe (k, v)
findKey :: (v -> Bool) -> Map k v -> Maybe (k, v)
findKey v -> Bool
p Map k v
m =
  case Map k v -> [(k, v)]
forall k a. Map k a -> [(k, a)]
Map.toList ((v -> Bool) -> Map k v -> Map k v
forall a k. (a -> Bool) -> Map k a -> Map k a
Map.filter v -> Bool
p Map k v
m) of
    [(k
k, v
v)] -> (k, v) -> Maybe (k, v)
forall a. a -> Maybe a
Just (k
k, v
v)
    [(k, v)]
_        -> Maybe (k, v)
forall a. Maybe a
Nothing

-- | `S_TryNextRule` is a structural `PredicateFailure`, used to fail from
-- one transition rule to the other. The other `PredicateFailure`s are all
-- throwable.
data UpendPredicateFailure
  = ProtVerUnknown ProtVer
  | S_TryNextRule
  | CanAdopt ProtVer
  | CannotAdopt ProtVer
  | NotADelegate VKey
  | UnconfirmedProposal UpId
  deriving (UpendPredicateFailure -> UpendPredicateFailure -> Bool
(UpendPredicateFailure -> UpendPredicateFailure -> Bool)
-> (UpendPredicateFailure -> UpendPredicateFailure -> Bool)
-> Eq UpendPredicateFailure
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpendPredicateFailure -> UpendPredicateFailure -> Bool
$c/= :: UpendPredicateFailure -> UpendPredicateFailure -> Bool
== :: UpendPredicateFailure -> UpendPredicateFailure -> Bool
$c== :: UpendPredicateFailure -> UpendPredicateFailure -> Bool
Eq, Int -> UpendPredicateFailure -> ShowS
[UpendPredicateFailure] -> ShowS
UpendPredicateFailure -> String
(Int -> UpendPredicateFailure -> ShowS)
-> (UpendPredicateFailure -> String)
-> ([UpendPredicateFailure] -> ShowS)
-> Show UpendPredicateFailure
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpendPredicateFailure] -> ShowS
$cshowList :: [UpendPredicateFailure] -> ShowS
show :: UpendPredicateFailure -> String
$cshow :: UpendPredicateFailure -> String
showsPrec :: Int -> UpendPredicateFailure -> ShowS
$cshowsPrec :: Int -> UpendPredicateFailure -> ShowS
Show, Typeable UpendPredicateFailure
DataType
Constr
Typeable UpendPredicateFailure
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> UpendPredicateFailure
    -> c UpendPredicateFailure)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UpendPredicateFailure)
-> (UpendPredicateFailure -> Constr)
-> (UpendPredicateFailure -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UpendPredicateFailure))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c UpendPredicateFailure))
-> ((forall b. Data b => b -> b)
    -> UpendPredicateFailure -> UpendPredicateFailure)
-> (forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> UpendPredicateFailure
    -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> UpendPredicateFailure
    -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> UpendPredicateFailure -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> UpendPredicateFailure -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> UpendPredicateFailure -> m UpendPredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UpendPredicateFailure -> m UpendPredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UpendPredicateFailure -> m UpendPredicateFailure)
-> Data UpendPredicateFailure
UpendPredicateFailure -> DataType
UpendPredicateFailure -> Constr
(forall b. Data b => b -> b)
-> UpendPredicateFailure -> UpendPredicateFailure
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpendPredicateFailure
-> c UpendPredicateFailure
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpendPredicateFailure
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> UpendPredicateFailure -> u
forall u.
(forall d. Data d => d -> u) -> UpendPredicateFailure -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpendPredicateFailure -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpendPredicateFailure -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UpendPredicateFailure -> m UpendPredicateFailure
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpendPredicateFailure -> m UpendPredicateFailure
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpendPredicateFailure
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpendPredicateFailure
-> c UpendPredicateFailure
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UpendPredicateFailure)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpendPredicateFailure)
$cUnconfirmedProposal :: Constr
$cNotADelegate :: Constr
$cCannotAdopt :: Constr
$cCanAdopt :: Constr
$cS_TryNextRule :: Constr
$cProtVerUnknown :: Constr
$tUpendPredicateFailure :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> UpendPredicateFailure -> m UpendPredicateFailure
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpendPredicateFailure -> m UpendPredicateFailure
gmapMp :: (forall d. Data d => d -> m d)
-> UpendPredicateFailure -> m UpendPredicateFailure
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpendPredicateFailure -> m UpendPredicateFailure
gmapM :: (forall d. Data d => d -> m d)
-> UpendPredicateFailure -> m UpendPredicateFailure
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UpendPredicateFailure -> m UpendPredicateFailure
gmapQi :: Int -> (forall d. Data d => d -> u) -> UpendPredicateFailure -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> UpendPredicateFailure -> u
gmapQ :: (forall d. Data d => d -> u) -> UpendPredicateFailure -> [u]
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> UpendPredicateFailure -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpendPredicateFailure -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UpendPredicateFailure -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpendPredicateFailure -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UpendPredicateFailure -> r
gmapT :: (forall b. Data b => b -> b)
-> UpendPredicateFailure -> UpendPredicateFailure
$cgmapT :: (forall b. Data b => b -> b)
-> UpendPredicateFailure -> UpendPredicateFailure
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpendPredicateFailure)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpendPredicateFailure)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UpendPredicateFailure)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UpendPredicateFailure)
dataTypeOf :: UpendPredicateFailure -> DataType
$cdataTypeOf :: UpendPredicateFailure -> DataType
toConstr :: UpendPredicateFailure -> Constr
$ctoConstr :: UpendPredicateFailure -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpendPredicateFailure
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpendPredicateFailure
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpendPredicateFailure
-> c UpendPredicateFailure
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpendPredicateFailure
-> c UpendPredicateFailure
$cp1Data :: Typeable UpendPredicateFailure
Data, Typeable, (forall x. UpendPredicateFailure -> Rep UpendPredicateFailure x)
-> (forall x. Rep UpendPredicateFailure x -> UpendPredicateFailure)
-> Generic UpendPredicateFailure
forall x. Rep UpendPredicateFailure x -> UpendPredicateFailure
forall x. UpendPredicateFailure -> Rep UpendPredicateFailure x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpendPredicateFailure x -> UpendPredicateFailure
$cfrom :: forall x. UpendPredicateFailure -> Rep UpendPredicateFailure x
Generic, Context -> UpendPredicateFailure -> IO (Maybe ThunkInfo)
Proxy UpendPredicateFailure -> String
(Context -> UpendPredicateFailure -> IO (Maybe ThunkInfo))
-> (Context -> UpendPredicateFailure -> IO (Maybe ThunkInfo))
-> (Proxy UpendPredicateFailure -> String)
-> NoThunks UpendPredicateFailure
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy UpendPredicateFailure -> String
$cshowTypeOf :: Proxy UpendPredicateFailure -> String
wNoThunks :: Context -> UpendPredicateFailure -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> UpendPredicateFailure -> IO (Maybe ThunkInfo)
noThunks :: Context -> UpendPredicateFailure -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> UpendPredicateFailure -> IO (Maybe ThunkInfo)
NoThunks)

instance STS UPEND where
  type Environment UPEND =
    ( Core.Slot                    -- Current slot number
    , Natural                      -- Adoption threshold
    , Bimap VKeyGenesis VKey       -- Delegation map
    , Map UpId Core.Slot           -- Confirmed proposals
    , Map UpId (ProtVer, PParams)  -- Registered update proposals
    , BlockCount                   -- Chain stability parameter. This
                                   -- is deemed to be a global
                                   -- constant that we temporarily put
                                   -- there.
    )
  type State UPEND =
    ( [(Core.Slot, (ProtVer, PParams))]
    , Set (ProtVer, Core.VKeyGenesis)
    )
  type Signal UPEND = (ProtVer, Core.VKey)
  type PredicateFailure UPEND = UpendPredicateFailure

  initialRules :: [InitialRule UPEND]
initialRules = []
  transitionRules :: [TransitionRule UPEND]
transitionRules =
    [
      do
        TRC ( (sn, _t, _dms, cps, rpus, k)
            , (fads, bvs)
            , (bv, _vk)
            ) <- F (Clause UPEND 'Transition) (TRC UPEND)
forall sts (rtype :: RuleType).
Rule sts rtype (RuleContext rtype sts)
judgmentContext
        case ((ProtVer, PParams) -> Bool)
-> Map UpId (ProtVer, PParams) -> Maybe (UpId, (ProtVer, PParams))
forall v k. (v -> Bool) -> Map k v -> Maybe (k, v)
findKey ((ProtVer -> ProtVer -> Bool
forall a. Eq a => a -> a -> Bool
== ProtVer
bv) (ProtVer -> Bool)
-> ((ProtVer, PParams) -> ProtVer) -> (ProtVer, PParams) -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ProtVer, PParams) -> ProtVer
forall a b. (a, b) -> a
fst) Map UpId (ProtVer, PParams)
rpus of
          Just (UpId
pid, (ProtVer, PParams)
_) -> do
            -- If we found the proposal id that corresponds to 'bv' then we
            -- have to check that it isn't confirmed for this rule to succeed.
            UpId
pid UpId -> Set UpId -> Bool
forall a (f :: * -> *). (Eq a, Foldable f) => a -> f a -> Bool
 Map UpId Slot -> Set (Domain (Map UpId Slot))
forall m. (Relation m, Ord (Domain m)) => m -> Set (Domain m)
dom (Map UpId Slot
cps Map UpId Slot -> Range (Map UpId Slot) -> Map UpId Slot
forall m. (Relation m, Ord (Range m)) => m -> Range m -> m
▷<= Slot
sn  Slot -> SlotCount -> Slot
-. Word64
2 Word64 -> BlockCount -> SlotCount
*. BlockCount
k) Bool -> PredicateFailure UPEND -> Rule UPEND 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure UPEND
UpendPredicateFailure
S_TryNextRule
            ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
-> F (Clause UPEND 'Transition)
     ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
 -> F (Clause UPEND 'Transition)
      ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis)))
-> ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
-> F (Clause UPEND 'Transition)
     ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
forall a b. (a -> b) -> a -> b
$! ([(Slot, (ProtVer, PParams))]
fads, Set (ProtVer, VKeyGenesis)
bvs)
          Maybe (UpId, (ProtVer, PParams))
Nothing ->
            -- If we didn't find the proposal id that corresponds to 'bv' then
            -- this rule succeeds.
            --
            -- Note that the difference w.r.t. the case above is that this case
            -- will succeed, whereas the case above can cause a predicate
            -- failure if the condition of the '!?' operator is not met. Since
            -- even on failure we _need_ to return a state, the case above also
            -- returns the state unchanged in this case.
            ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
-> F (Clause UPEND 'Transition)
     ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
 -> F (Clause UPEND 'Transition)
      ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis)))
-> ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
-> F (Clause UPEND 'Transition)
     ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
forall a b. (a -> b) -> a -> b
$! ([(Slot, (ProtVer, PParams))]
fads, Set (ProtVer, VKeyGenesis)
bvs)

    , do
        TRC ( (sn, t, dms, cps, rpus, k)
            , (fads, bvs)
            , (bv, vk)
            ) <- F (Clause UPEND 'Transition) (TRC UPEND)
forall sts (rtype :: RuleType).
Rule sts rtype (RuleContext rtype sts)
judgmentContext
        case VKey -> Bimap VKeyGenesis VKey -> Maybe VKeyGenesis
forall a b (m :: * -> *).
(Ord a, Ord b, MonadThrow m) =>
b -> Bimap a b -> m a
lookupR VKey
vk Bimap VKeyGenesis VKey
dms of
          Maybe VKeyGenesis
Nothing  -> do
            Bool
False Bool -> PredicateFailure UPEND -> Rule UPEND 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure UPEND
UpendPredicateFailure
S_TryNextRule
            ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
-> F (Clause UPEND 'Transition)
     ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
 -> F (Clause UPEND 'Transition)
      ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis)))
-> ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
-> F (Clause UPEND 'Transition)
     ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
forall a b. (a -> b) -> a -> b
$! ([(Slot, (ProtVer, PParams))]
fads, Set (ProtVer, VKeyGenesis)
bvs)
          Just VKeyGenesis
vks -> do
            let bvs' :: Set (ProtVer, VKeyGenesis)
bvs' = Set (ProtVer, VKeyGenesis)
bvs Set (ProtVer, VKeyGenesis)
-> Set (ProtVer, VKeyGenesis) -> Set (ProtVer, VKeyGenesis)
forall m.
(Relation m, Ord (Domain m), Ord (Range m)) =>
m -> m -> m
 Domain (Set (ProtVer, VKeyGenesis))
-> Range (Set (ProtVer, VKeyGenesis)) -> Set (ProtVer, VKeyGenesis)
forall m. Relation m => Domain m -> Range m -> m
singleton Domain (Set (ProtVer, VKeyGenesis))
ProtVer
bv Range (Set (ProtVer, VKeyGenesis))
VKeyGenesis
vks
            Set (ProtVer, VKeyGenesis) -> Natural
forall m n. (Relation m, Integral n) => m -> n
size ([ProtVer
bv] [Domain (Set (ProtVer, VKeyGenesis))]
-> Set (ProtVer, VKeyGenesis) -> Set (ProtVer, VKeyGenesis)
forall m (f :: * -> *).
(Relation m, Ord (Domain m), Foldable f) =>
f (Domain m) -> m -> m
 Set (ProtVer, VKeyGenesis)
bvs') Natural -> Natural -> Bool
forall a. Ord a => a -> a -> Bool
< Natural
t Bool -> PredicateFailure UPEND -> Rule UPEND 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! ProtVer -> UpendPredicateFailure
CanAdopt ProtVer
bv
            case ((ProtVer, PParams) -> Bool)
-> Map UpId (ProtVer, PParams) -> Maybe (UpId, (ProtVer, PParams))
forall v k. (v -> Bool) -> Map k v -> Maybe (k, v)
findKey ((ProtVer -> ProtVer -> Bool
forall a. Eq a => a -> a -> Bool
== ProtVer
bv) (ProtVer -> Bool)
-> ((ProtVer, PParams) -> ProtVer) -> (ProtVer, PParams) -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ProtVer, PParams) -> ProtVer
forall a b. (a, b) -> a
fst) Map UpId (ProtVer, PParams)
rpus of
              Just (UpId
pid, (ProtVer, PParams)
_) -> do
                UpId
pid UpId -> Set UpId -> Bool
forall a (f :: * -> *). (Eq a, Foldable f) => a -> f a -> Bool
 Map UpId Slot -> Set (Domain (Map UpId Slot))
forall m. (Relation m, Ord (Domain m)) => m -> Set (Domain m)
dom (Map UpId Slot
cps Map UpId Slot -> Range (Map UpId Slot) -> Map UpId Slot
forall m. (Relation m, Ord (Range m)) => m -> Range m -> m
▷<= Slot
sn Slot -> SlotCount -> Slot
-. Word64
2 Word64 -> BlockCount -> SlotCount
*. BlockCount
k) Bool -> PredicateFailure UPEND -> Rule UPEND 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure UPEND
UpendPredicateFailure
S_TryNextRule
                ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
-> F (Clause UPEND 'Transition)
     ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
 -> F (Clause UPEND 'Transition)
      ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis)))
-> ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
-> F (Clause UPEND 'Transition)
     ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
forall a b. (a -> b) -> a -> b
$! ([(Slot, (ProtVer, PParams))]
fads, Set (ProtVer, VKeyGenesis)
bvs')
              Maybe (UpId, (ProtVer, PParams))
Nothing -> do
                Bool
False Bool -> PredicateFailure UPEND -> Rule UPEND 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! PredicateFailure UPEND
UpendPredicateFailure
S_TryNextRule
                ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
-> F (Clause UPEND 'Transition)
     ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
 -> F (Clause UPEND 'Transition)
      ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis)))
-> ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
-> F (Clause UPEND 'Transition)
     ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
forall a b. (a -> b) -> a -> b
$! ([(Slot, (ProtVer, PParams))]
fads, Set (ProtVer, VKeyGenesis)
bvs')

    , do
        TRC ( (sn, t, dms, cps, rpus, k)
            , (fads, bvs)
            , (bv, vk)
            ) <- F (Clause UPEND 'Transition) (TRC UPEND)
forall sts (rtype :: RuleType).
Rule sts rtype (RuleContext rtype sts)
judgmentContext
        case VKey -> Bimap VKeyGenesis VKey -> Maybe VKeyGenesis
forall a b (m :: * -> *).
(Ord a, Ord b, MonadThrow m) =>
b -> Bimap a b -> m a
lookupR VKey
vk Bimap VKeyGenesis VKey
dms of
          Maybe VKeyGenesis
Nothing  -> do
            Bool
False Bool -> PredicateFailure UPEND -> Rule UPEND 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! VKey -> UpendPredicateFailure
NotADelegate VKey
vk
            ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
-> F (Clause UPEND 'Transition)
     ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
 -> F (Clause UPEND 'Transition)
      ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis)))
-> ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
-> F (Clause UPEND 'Transition)
     ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
forall a b. (a -> b) -> a -> b
$! ([(Slot, (ProtVer, PParams))]
fads, Set (ProtVer, VKeyGenesis)
bvs)
          Just VKeyGenesis
vks -> do
            let bvs' :: Set (ProtVer, VKeyGenesis)
bvs' = Set (ProtVer, VKeyGenesis)
bvs Set (ProtVer, VKeyGenesis)
-> Set (ProtVer, VKeyGenesis) -> Set (ProtVer, VKeyGenesis)
forall m.
(Relation m, Ord (Domain m), Ord (Range m)) =>
m -> m -> m
 Domain (Set (ProtVer, VKeyGenesis))
-> Range (Set (ProtVer, VKeyGenesis)) -> Set (ProtVer, VKeyGenesis)
forall m. Relation m => Domain m -> Range m -> m
singleton Domain (Set (ProtVer, VKeyGenesis))
ProtVer
bv Range (Set (ProtVer, VKeyGenesis))
VKeyGenesis
vks
            Natural
t Natural -> Natural -> Bool
forall a. Ord a => a -> a -> Bool
<= Set (ProtVer, VKeyGenesis) -> Natural
forall m n. (Relation m, Integral n) => m -> n
size ([ProtVer
bv] [Domain (Set (ProtVer, VKeyGenesis))]
-> Set (ProtVer, VKeyGenesis) -> Set (ProtVer, VKeyGenesis)
forall m (f :: * -> *).
(Relation m, Ord (Domain m), Foldable f) =>
f (Domain m) -> m -> m
 Set (ProtVer, VKeyGenesis)
bvs') Bool -> PredicateFailure UPEND -> Rule UPEND 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! ProtVer -> UpendPredicateFailure
CannotAdopt ProtVer
bv
            case ((ProtVer, PParams) -> Bool)
-> Map UpId (ProtVer, PParams) -> Maybe (UpId, (ProtVer, PParams))
forall v k. (v -> Bool) -> Map k v -> Maybe (k, v)
findKey ((ProtVer -> ProtVer -> Bool
forall a. Eq a => a -> a -> Bool
== ProtVer
bv) (ProtVer -> Bool)
-> ((ProtVer, PParams) -> ProtVer) -> (ProtVer, PParams) -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ProtVer, PParams) -> ProtVer
forall a b. (a, b) -> a
fst) Map UpId (ProtVer, PParams)
rpus of
              Just (UpId
pid, (ProtVer
_, PParams
ppsc)) -> do
                UpId
pid UpId -> Set UpId -> Bool
forall a (f :: * -> *). (Eq a, Foldable f) => a -> f a -> Bool
 Map UpId Slot -> Set (Domain (Map UpId Slot))
forall m. (Relation m, Ord (Domain m)) => m -> Set (Domain m)
dom (Map UpId Slot
cps  Map UpId Slot -> Range (Map UpId Slot) -> Map UpId Slot
forall m. (Relation m, Ord (Range m)) => m -> Range m -> m
▷<= Slot
sn Slot -> SlotCount -> Slot
-. Word64
2 Word64 -> BlockCount -> SlotCount
*. BlockCount
k) Bool -> PredicateFailure UPEND -> Rule UPEND 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! UpId -> UpendPredicateFailure
UnconfirmedProposal UpId
pid
                [(Slot, (ProtVer, PParams))]
fads' <- forall sub super (rtype :: RuleType).
Embed sub super =>
RuleContext rtype sub -> Rule super rtype (State sub)
forall super (rtype :: RuleType).
Embed FADS super =>
RuleContext rtype FADS -> Rule super rtype (State FADS)
trans @FADS (RuleContext 'Transition FADS
 -> Rule UPEND 'Transition (State FADS))
-> RuleContext 'Transition FADS
-> Rule UPEND 'Transition (State FADS)
forall a b. (a -> b) -> a -> b
$ (Environment FADS, State FADS, Signal FADS) -> TRC FADS
forall sts. (Environment sts, State sts, Signal sts) -> TRC sts
TRC ((), [(Slot, (ProtVer, PParams))]
State FADS
fads, (Slot
sn, (ProtVer
bv, PParams
ppsc)))
                ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
-> F (Clause UPEND 'Transition)
     ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
 -> F (Clause UPEND 'Transition)
      ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis)))
-> ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
-> F (Clause UPEND 'Transition)
     ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
forall a b. (a -> b) -> a -> b
$! ([(Slot, (ProtVer, PParams))]
fads', Set (ProtVer, VKeyGenesis)
bvs')
              Maybe (UpId, (ProtVer, PParams))
Nothing -> do
                Bool
False Bool -> PredicateFailure UPEND -> Rule UPEND 'Transition ()
forall sts (ctx :: RuleType).
Bool -> PredicateFailure sts -> Rule sts ctx ()
?! ProtVer -> UpendPredicateFailure
ProtVerUnknown ProtVer
bv
                ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
-> F (Clause UPEND 'Transition)
     ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
 -> F (Clause UPEND 'Transition)
      ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis)))
-> ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
-> F (Clause UPEND 'Transition)
     ([(Slot, (ProtVer, PParams))], Set (ProtVer, VKeyGenesis))
forall a b. (a -> b) -> a -> b
$! ([(Slot, (ProtVer, PParams))]
fads, Set (ProtVer, VKeyGenesis)
bvs')

    ]

instance Embed FADS UPEND where
  wrapFailed :: PredicateFailure FADS -> PredicateFailure UPEND
wrapFailed = String -> FadsPredicateFailure -> UpendPredicateFailure
forall a. HasCallStack => String -> a
error String
"No possible failures in FADS"

------------------------------------------------------------------------
-- Update interface
------------------------------------------------------------------------

-- | The update interface environment is shared amongst various rules, so
--   we define it as an alias here.
type UPIEnv =
  ( Core.Slot
  , Bimap Core.VKeyGenesis Core.VKey
  , BlockCount -- This is a global constant in the formal
               -- specification, which we put in this environment so
               -- that we can test with different values of it.
  , Word8  -- Number of genesis keys, @ngk@. Also a global constant in the
           -- formal specification which is placed here so that we can test
           -- with different values.
  )

delegationMap :: UPIEnv -> Bimap Core.VKeyGenesis Core.VKey
delegationMap :: UPIEnv -> Bimap VKeyGenesis VKey
delegationMap (Slot
_, Bimap VKeyGenesis VKey
dms, BlockCount
_, Word8
_) = Bimap VKeyGenesis VKey
dms

-- | The update interface state is shared amongst various rules, so we define it
-- as an alias here.
type UPIState =
  ( (ProtVer, PParams) -- (pv, pps)
  , [(Core.Slot, (ProtVer, PParams))] -- fads
  , Map ApName (ApVer, Core.Slot, Metadata) -- avs
  , Map UpId (ProtVer, PParams) -- rpus
  , Map UpId (ApName, ApVer, Metadata) -- raus
  , Map UpId Core.Slot -- cps
  , Set (UpId, Core.VKeyGenesis) -- vts
  , Set (ProtVer, Core.VKeyGenesis) -- bvs
  , Map UpId Core.Slot -- pws
  )

emptyUPIState :: UPIState
emptyUPIState :: UPIState
emptyUPIState =
  (( Natural -> Natural -> Natural -> ProtVer
ProtVer Natural
0 Natural
0 Natural
0
   , PParams
initialPParams
   )
  , []
  , Map ApName (ApVer, Slot, Metadata)
forall k a. Map k a
Map.empty
  , Map UpId (ProtVer, PParams)
forall k a. Map k a
Map.empty
  , Map UpId (ApName, ApVer, Metadata)
forall k a. Map k a
Map.empty
  , Map UpId Slot
forall k a. Map k a
Map.empty
  , Set (UpId, VKeyGenesis)
forall a. Set a
Set.empty
  , Set (ProtVer, VKeyGenesis)
forall a. Set a
Set.empty
  , Map UpId Slot
forall k a. Map k a
Map.empty)

initialPParams :: PParams
initialPParams :: PParams
initialPParams =
  PParams :: Natural
-> Natural
-> Natural
-> Natural
-> BkSgnCntT
-> SlotCount
-> SlotCount
-> Natural
-> UpAdptThd
-> FactorA
-> FactorB
-> PParams
PParams                 -- TODO: choose more sensible default values
     { _maxBkSz :: Natural
_maxBkSz = Natural
10000       -- max sizes chosen as non-zero to allow progress
     , _maxHdrSz :: Natural
_maxHdrSz = Natural
1000
     , _maxTxSz :: Natural
_maxTxSz = Natural
500
     , _maxPropSz :: Natural
_maxPropSz = Natural
10
     , _bkSgnCntT :: BkSgnCntT
_bkSgnCntT = BkSgnCntT
0.22     -- As defined in the spec.
     , _bkSlotsPerEpoch :: SlotCount
_bkSlotsPerEpoch = SlotCount
10 -- TODO: we need to remove this, since this should
                             -- be a constant. Also the name slots-per-epoch is
                             -- wrong.
     , _upTtl :: SlotCount
_upTtl = SlotCount
10           -- The proposal time to live needs to be related to @k@ (or the number
                             -- of slots in an epoch). We pick an arbitrary value here.
     , _scriptVersion :: Natural
_scriptVersion = Natural
0
     , _upAdptThd :: UpAdptThd
_upAdptThd = UpAdptThd
0.6      -- Value currently used in mainet

     -- To determine the factors @A@ and @B@ used in the calculation of the
     -- transaction fees we need to know the constant @C@ that we use to bound
     -- the size of a transaction.
     --
     -- We have that for all transactions @tx@:
     --
     -- > size (elaborate tx) <= C * abstractSize tx
     --
     -- where @elaborate@ elaborates an abstract transaction into a concrete
     -- one.
     --
     -- We have that the (concrete) minimum fee is calculated as follows:
     --
     -- > minFee tx = A_C + B_C * C
     --
     -- where @A_C@ and @B_C@ are the concrete constants that correspond to
     -- abstract constants @A@ and @B@.
     --
     -- We need to guarantee that the abstract minimum fee we use for
     -- transactions is no less than the concrete minimum fee, since otherwise
     -- we run the risk that in the elaboration we end up paying a fee to low.
     --
     -- Now consider the minimum fee for an elaborated transaction:
     --
     -- > A_C + B_C * (size (elaborate tx))
     -- > <= { size (elaborate tx) <= C * abstractSize tx }
     -- > A_C + B_C * C * abstractSize tx
     --
     -- Which means that we should set:
     --
     -- > _factorA = A_C
     -- > _factorB = B_C * C
     --
     -- For now we choose small numbers here so that we do not need a high UTxO
     -- balance when generating the initial UTxO (see @module
     -- Byron.Spec.Ledger.UTxO.Generators@).
     , _factorA :: FactorA
_factorA = Int -> FactorA
FactorA Int
1 -- In mainet this value is set to 155381000000000 (A_C in the derivation above)
     , _factorB :: FactorB
_factorB = Int -> FactorB
FactorB (Int
10 Int -> Int -> Int
forall a. Num a => a -> a -> a
* Word64 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word64
GP.c) -- In mainet this value is set to 43946000000
     }

protocolVersion :: UPIState -> ProtVer
protocolVersion :: UPIState -> ProtVer
protocolVersion ((ProtVer
pv, PParams
_), [(Slot, (ProtVer, PParams))]
_, Map ApName (ApVer, Slot, Metadata)
_, Map UpId (ProtVer, PParams)
_, Map UpId (ApName, ApVer, Metadata)
_, Map UpId Slot
_, Set (UpId, VKeyGenesis)
_, Set (ProtVer, VKeyGenesis)
_, Map UpId Slot
_) = ProtVer
pv

protocolParameters :: UPIState -> PParams
protocolParameters :: UPIState -> PParams
protocolParameters ((ProtVer
_, PParams
pps), [(Slot, (ProtVer, PParams))]
_, Map ApName (ApVer, Slot, Metadata)
_, Map UpId (ProtVer, PParams)
_, Map UpId (ApName, ApVer, Metadata)
_, Map UpId Slot
_, Set (UpId, VKeyGenesis)
_, Set (ProtVer, VKeyGenesis)
_, Map UpId Slot
_) = PParams
pps

applicationVersions :: UPIState -> Map ApName (ApVer, Core.Slot, Metadata)
applicationVersions :: UPIState -> Map ApName (ApVer, Slot, Metadata)
applicationVersions ((ProtVer
_, PParams
_), [(Slot, (ProtVer, PParams))]
_, Map ApName (ApVer, Slot, Metadata)
avs, Map UpId (ProtVer, PParams)
_, Map UpId (ApName, ApVer, Metadata)
_, Map UpId Slot
_, Set (UpId, VKeyGenesis)
_, Set (ProtVer, VKeyGenesis)
_, Map UpId Slot
_) = Map ApName (ApVer, Slot, Metadata)
avs

confirmedProposals :: UPIState -> Map UpId Core.Slot
confirmedProposals :: UPIState -> Map UpId Slot
confirmedProposals ((ProtVer
_, PParams
_), [(Slot, (ProtVer, PParams))]
_, Map ApName (ApVer, Slot, Metadata)
_, Map UpId (ProtVer, PParams)
_, Map UpId (ApName, ApVer, Metadata)
_, Map UpId Slot
cps, Set (UpId, VKeyGenesis)
_, Set (ProtVer, VKeyGenesis)
_, Map UpId Slot
_) = Map UpId Slot
cps

futureAdoptions :: UPIState -> [(Core.Slot, (ProtVer, PParams))]
futureAdoptions :: UPIState -> [(Slot, (ProtVer, PParams))]
futureAdoptions ((ProtVer
_, PParams
_), [(Slot, (ProtVer, PParams))]
fads, Map ApName (ApVer, Slot, Metadata)
_, Map UpId (ProtVer, PParams)
_, Map UpId (ApName, ApVer, Metadata)
_, Map UpId Slot
_, Set (UpId, VKeyGenesis)
_, Set (ProtVer, VKeyGenesis)
_, Map UpId Slot
_) = [(Slot, (ProtVer, PParams))]
fads

endorsements :: UPIState -> Set (ProtVer, Core.VKeyGenesis)
endorsements :: UPIState -> Set (ProtVer, VKeyGenesis)
endorsements ((ProtVer
_, PParams
_), [(Slot, (ProtVer, PParams))]
_, Map ApName (ApVer, Slot, Metadata)
_, Map UpId (ProtVer, PParams)
_, Map UpId (ApName, ApVer, Metadata)
_, Map UpId Slot
_, Set (UpId, VKeyGenesis)
_, Set (ProtVer, VKeyGenesis)
bvs, Map UpId Slot
_) = Set (ProtVer, VKeyGenesis)
bvs

registeredProtocolUpdateProposals :: UPIState -> Map UpId (ProtVer, PParams)
registeredProtocolUpdateProposals :: UPIState -> Map UpId (ProtVer, PParams)
registeredProtocolUpdateProposals ((ProtVer
_, PParams
_), [(Slot, (ProtVer, PParams))]
_, Map ApName (ApVer, Slot, Metadata)
_, Map UpId (ProtVer, PParams)
rpus, Map UpId (ApName, ApVer, Metadata)
_, Map UpId Slot
_, Set (UpId, VKeyGenesis)
_, Set (ProtVer, VKeyGenesis)
_, Map UpId Slot
_) = Map UpId (ProtVer, PParams)
rpus


data UPIREG deriving ((forall x. UPIREG -> Rep UPIREG x)
-> (forall x. Rep UPIREG x -> UPIREG) -> Generic UPIREG
forall x. Rep UPIREG x -> UPIREG
forall x. UPIREG -> Rep UPIREG x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UPIREG x -> UPIREG
$cfrom :: forall x. UPIREG -> Rep UPIREG x
Generic, Typeable UPIREG
DataType
Typeable UPIREG
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> UPIREG -> c UPIREG)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UPIREG)
-> (UPIREG -> Constr)
-> (UPIREG -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UPIREG))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPIREG))
-> ((forall b. Data b => b -> b) -> UPIREG -> UPIREG)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> UPIREG -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> UPIREG -> r)
-> (forall u. (forall d. Data d => d -> u) -> UPIREG -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> UPIREG -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> UPIREG -> m UPIREG)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UPIREG -> m UPIREG)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> UPIREG -> m UPIREG)
-> Data UPIREG
UPIREG -> DataType
UPIREG -> Constr
(forall b. Data b => b -> b) -> UPIREG -> UPIREG
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPIREG -> c UPIREG
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPIREG
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> UPIREG -> u
forall u. (forall d. Data d => d -> u) -> UPIREG -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPIREG -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPIREG -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UPIREG -> m UPIREG
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPIREG -> m UPIREG
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPIREG
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPIREG -> c UPIREG
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UPIREG)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPIREG)
$tUPIREG :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> UPIREG -> m UPIREG
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPIREG -> m UPIREG
gmapMp :: (forall d. Data d => d -> m d) -> UPIREG -> m UPIREG
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UPIREG -> m UPIREG
gmapM :: (forall d. Data d => d -> m d) -> UPIREG -> m UPIREG
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UPIREG -> m UPIREG
gmapQi :: Int -> (forall d. Data d => d -> u) -> UPIREG -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> UPIREG -> u
gmapQ :: (forall d. Data d => d -> u) -> UPIREG -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> UPIREG -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPIREG -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UPIREG -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPIREG -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UPIREG -> r
gmapT :: (forall b. Data b => b -> b) -> UPIREG -> UPIREG
$cgmapT :: (forall b. Data b => b -> b) -> UPIREG -> UPIREG
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPIREG)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UPIREG)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UPIREG)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UPIREG)
dataTypeOf :: UPIREG -> DataType
$cdataTypeOf :: UPIREG -> DataType
toConstr :: UPIREG -> Constr
$ctoConstr :: UPIREG -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPIREG
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UPIREG
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPIREG -> c UPIREG
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UPIREG -> c UPIREG
$cp1Data :: Typeable UPIREG
Data, Typeable)

data UpiregPredicateFailure
  = UPREGFailure (PredicateFailure UPREG)
  deriving (UpiregPredicateFailure -> UpiregPredicateFailure -> Bool
(UpiregPredicateFailure -> UpiregPredicateFailure -> Bool)
-> (UpiregPredicateFailure -> UpiregPredicateFailure -> Bool)
-> Eq UpiregPredicateFailure
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpiregPredicateFailure -> UpiregPredicateFailure -> Bool
$c/= :: UpiregPredicateFailure -> UpiregPredicateFailure -> Bool
== :: UpiregPredicateFailure -> UpiregPredicateFailure -> Bool
$c== :: UpiregPredicateFailure -> UpiregPredicateFailure -> Bool
Eq, Int -> UpiregPredicateFailure -> ShowS
[UpiregPredicateFailure] -> ShowS
UpiregPredicateFailure -> String
(Int -> UpiregPredicateFailure -> ShowS)
-> (UpiregPredicateFailure -> String)
-> ([UpiregPredicateFailure] -> ShowS)
-> Show UpiregPredicateFailure
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpiregPredicateFailure] -> ShowS
$cshowList :: [UpiregPredicateFailure] -> ShowS
show :: UpiregPredicateFailure -> String
$cshow :: UpiregPredicateFailure -> String
showsPrec :: Int -> UpiregPredicateFailure -> ShowS
$cshowsPrec :: Int -> UpiregPredicateFailure -> ShowS
Show, Typeable UpiregPredicateFailure
DataType
Constr
Typeable UpiregPredicateFailure
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> UpiregPredicateFailure
    -> c UpiregPredicateFailure)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UpiregPredicateFailure)
-> (UpiregPredicateFailure -> Constr)
-> (UpiregPredicateFailure -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UpiregPredicateFailure))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c UpiregPredicateFailure))
-> ((forall b. Data b => b -> b)
    -> UpiregPredicateFailure -> UpiregPredicateFailure)
-> (forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> UpiregPredicateFailure
    -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> UpiregPredicateFailure
    -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> UpiregPredicateFailure -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> UpiregPredicateFailure -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> UpiregPredicateFailure -> m UpiregPredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UpiregPredicateFailure -> m UpiregPredicateFailure)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UpiregPredicateFailure -> m UpiregPredicateFailure)
-> Data UpiregPredicateFailure
UpiregPredicateFailure -> DataType
UpiregPredicateFailure -> Constr
(forall b. Data b => b -> b)
-> UpiregPredicateFailure -> UpiregPredicateFailure
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpiregPredicateFailure
-> c UpiregPredicateFailure
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpiregPredicateFailure
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> UpiregPredicateFailure -> u
forall u.
(forall d. Data d => d -> u) -> UpiregPredicateFailure -> [u]
forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpiregPredicateFailure
-> r
forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpiregPredicateFailure
-> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UpiregPredicateFailure -> m UpiregPredicateFailure
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpiregPredicateFailure -> m UpiregPredicateFailure
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpiregPredicateFailure
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpiregPredicateFailure
-> c UpiregPredicateFailure
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UpiregPredicateFailure)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpiregPredicateFailure)
$cUPREGFailure :: Constr
$tUpiregPredicateFailure :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> UpiregPredicateFailure -> m UpiregPredicateFailure
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpiregPredicateFailure -> m UpiregPredicateFailure
gmapMp :: (forall d. Data d => d -> m d)
-> UpiregPredicateFailure -> m UpiregPredicateFailure
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UpiregPredicateFailure -> m UpiregPredicateFailure
gmapM :: (forall d. Data d => d -> m d)
-> UpiregPredicateFailure -> m UpiregPredicateFailure
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UpiregPredicateFailure -> m UpiregPredicateFailure
gmapQi :: Int -> (forall d. Data d => d -> u) -> UpiregPredicateFailure -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> UpiregPredicateFailure -> u
gmapQ :: (forall d. Data d => d -> u) -> UpiregPredicateFailure -> [u]
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> UpiregPredicateFailure -> [u]
gmapQr :: (r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpiregPredicateFailure
-> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpiregPredicateFailure
-> r
gmapQl :: (r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpiregPredicateFailure
-> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> UpiregPredicateFailure
-> r
gmapT :: (forall b. Data b => b -> b)
-> UpiregPredicateFailure -> UpiregPredicateFailure
$cgmapT :: (forall b. Data b => b -> b)
-> UpiregPredicateFailure -> UpiregPredicateFailure
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpiregPredicateFailure)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UpiregPredicateFailure)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UpiregPredicateFailure)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UpiregPredicateFailure)
dataTypeOf :: UpiregPredicateFailure -> DataType
$cdataTypeOf :: UpiregPredicateFailure -> DataType
toConstr :: UpiregPredicateFailure -> Constr
$ctoConstr :: UpiregPredicateFailure -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpiregPredicateFailure
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UpiregPredicateFailure
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpiregPredicateFailure
-> c UpiregPredicateFailure
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> UpiregPredicateFailure
-> c UpiregPredicateFailure
$cp1Data :: Typeable UpiregPredicateFailure
Data, Typeable, (forall x. UpiregPredicateFailure -> Rep UpiregPredicateFailure x)
-> (forall x.
    Rep UpiregPredicateFailure x -> UpiregPredicateFailure)
-> Generic UpiregPredicateFailure
forall x. Rep UpiregPredicateFailure x -> UpiregPredicateFailure
forall x. UpiregPredicateFailure -> Rep UpiregPredicateFailure x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpiregPredicateFailure x -> UpiregPredicateFailure
$cfrom :: forall x. UpiregPredicateFailure -> Rep UpiregPredicateFailure x
Generic, Context -> UpiregPredicateFailure -> IO (Maybe ThunkInfo)
Proxy UpiregPredicateFailure -> String
(Context -> UpiregPredicateFailure -> IO (Maybe ThunkInfo))
-> (Context -> UpiregPredicateFailure -> IO (Maybe ThunkInfo))
-> (Proxy UpiregPredicateFailure -> String)
-> NoThunks UpiregPredicateFailure
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy UpiregPredicateFailure -> String
$cshowTypeOf :: Proxy UpiregPredicateFailure -> String
wNoThunks :: Context -> UpiregPredicateFailure -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> UpiregPredicateFailure -> IO (Maybe ThunkInfo)
noThunks :: Context -> UpiregPredicateFailure -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> UpiregPredicateFailure -> IO (Maybe ThunkInfo)
NoThunks)

instance STS UPIREG where
  type Environment UPIREG = UPIEnv
  type State UPIREG = UPIState
  type Signal UPIREG = UProp
  type PredicateFailure UPIREG = UpiregPredicateFailure

  initialRules :: [InitialRule UPIREG]
initialRules = [ UPIState -> F (Clause UPIREG 'Initial) UPIState
forall (m :: * -> *) a. Monad m => a -> m a
return (UPIState -> F (Clause UPIREG 'Initial) UPIState)
-> UPIState -> F (Clause UPIREG 'Initial) UPIState
forall a b. (a -> b) -> a -> b
$! UPIState
emptyUPIState ]

  transitionRules :: [TransitionRule UPIREG]
transitionRules =
    [ do
        TRC ( (sn, dms, _k, _ngk)
            , ( (pv, pps)
              , fads
              , avs
              , rpus
              , raus
              , cps
              , vts
              , bvs
              , pws)
            , Signal UPIREG
up) <- F (Clause UPIREG 'Transition) (TRC UPIREG)
forall sts (rtype :: RuleType).
Rule sts rtype (RuleContext rtype sts)
judgmentContext
        (Map UpId (ProtVer, PParams)
rpus', Map UpId (ApName, ApVer, Metadata)
raus') <- forall sub super (rtype :: RuleType).
Embed sub super =>
RuleContext rtype sub -> Rule super rtype (State sub)
forall super (rtype :: RuleType).
Embed UPREG super =>
RuleContext rtype UPREG -> Rule super rtype (State UPREG)
trans @UPREG (RuleContext 'Transition UPREG
 -> Rule UPIREG 'Transition (State UPREG))
-> RuleContext 'Transition UPREG
-> Rule UPIREG 'Transition (State UPREG)
forall a b. (a -> b) -> a -> b
$ (Environment UPREG, State UPREG, Signal UPREG) -> TRC UPREG
forall sts. (Environment sts, State sts, Signal sts) -> TRC sts
TRC ((ProtVer
pv, PParams
pps, Map ApName (ApVer, Slot, Metadata)
avs, Bimap VKeyGenesis VKey
dms), (Map UpId (ProtVer, PParams)
rpus, Map UpId (ApName, ApVer, Metadata)
raus), Signal UPREG
Signal UPIREG
up)
        let pws' :: Map UpId Slot
pws' = Map UpId Slot
pws Map UpId Slot
-> [(Domain (Map UpId Slot), Range (Map UpId Slot))]
-> Map UpId Slot
forall m (f :: * -> *).
(Relation m, Ord (Domain m), Ord (Range m), Foldable f) =>
m -> f (Domain m, Range m) -> m
 [(Signal UPIREG
UProp
up UProp -> Getting UpId UProp UpId -> UpId
forall s a. s -> Getting a s a -> a
^. Getting UpId UProp UpId
Lens' UProp UpId
upId, Slot
sn)]
        UPIState -> F (Clause UPIREG 'Transition) UPIState
forall (f :: * -> *) a. Applicative f => a -> f a
pure (UPIState -> F (Clause UPIREG 'Transition) UPIState)
-> UPIState -> F (Clause UPIREG 'Transition) UPIState
forall a b. (a -> b) -> a -> b
$! ( (ProtVer
pv, PParams
pps)
                , [(Slot, (ProtVer, PParams))]
fads
                , Map ApName (ApVer, Slot, Metadata)
avs
                , Map UpId (ProtVer, PParams)
rpus'
                , Map UpId (ApName, ApVer, Metadata)
raus'
                , Map UpId Slot
cps
                , Set (UpId, VKeyGenesis)
vts
                , Set (ProtVer, VKeyGenesis)
bvs
                , Map UpId Slot
pws'
                )

    ]

instance Embed UPREG UPIREG where
  wrapFailed :: PredicateFailure UPREG -> PredicateFailure UPIREG
wrapFailed = PredicateFailure UPREG -> PredicateFailure UPIREG
PredicateFailure UPREG -> UpiregPredicateFailure
UPREGFailure

instance HasTrace UPIREG where

  envGen :: Word64 -> Gen (Environment UPIREG)
envGen Word64
_ = Gen UPIEnv
Gen (Environment UPIREG)
upiEnvGen

  sigGen :: SignalGenerator UPIREG
sigGen (_slot, dms, _k, _ngk) ((pv, pps), _fads, avs, rpus, raus, _cps, _vts, _bvs, pws)
    = do
    (VKey
vk, ProtVer
pv', PParams
pps', SwVer
sv') <- (,,,) (VKey
 -> ProtVer -> PParams -> SwVer -> (VKey, ProtVer, PParams, SwVer))
-> GenT Identity VKey
-> GenT
     Identity
     (ProtVer -> PParams -> SwVer -> (VKey, ProtVer, PParams, SwVer))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity VKey
issuerGen
                                  GenT
  Identity
  (ProtVer -> PParams -> SwVer -> (VKey, ProtVer, PParams, SwVer))
-> GenT Identity ProtVer
-> GenT
     Identity (PParams -> SwVer -> (VKey, ProtVer, PParams, SwVer))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity ProtVer
pvGen
                                  GenT Identity (PParams -> SwVer -> (VKey, ProtVer, PParams, SwVer))
-> GenT Identity PParams
-> GenT Identity (SwVer -> (VKey, ProtVer, PParams, SwVer))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity PParams
pparamsGen
                                  GenT Identity (SwVer -> (VKey, ProtVer, PParams, SwVer))
-> GenT Identity SwVer
-> GenT Identity (VKey, ProtVer, PParams, SwVer)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity SwVer
swVerGen

    [(Int, GenT Identity UProp)] -> GenT Identity UProp
forall (m :: * -> *) a. MonadGen m => [(Int, m a)] -> m a
Gen.frequency
      [ -- Do not change the protocol version. We generate a lower fraction of
        -- these kind of update proposals since we want to have more test cases
        -- in which the protocol parameters change. Software only updates do
        -- not offer as many possible variations as protocol parameter updates
        -- do.
        (Int
10, VKey -> PParams -> ProtVer -> SwVer -> GenT Identity UProp
generateUpdateProposalWith VKey
vk PParams
pps ProtVer
pv SwVer
sv')
      , -- Do not change the software version (unless there are no software
        -- versions in @avs@).
        (Int
45, do
          -- Pick a current software version (if available)
          let makeSoftwareVersion :: (ApName, (ApVer, b, c)) -> SwVer
makeSoftwareVersion (ApName
apName, (ApVer
apVersion, b
_, c
_)) = ApName -> ApVer -> SwVer
SwVer ApName
apName ApVer
apVersion
              avsList :: [(ApName, (ApVer, Slot, Metadata))]
avsList = Map ApName (ApVer, Slot, Metadata)
-> [(ApName, (ApVer, Slot, Metadata))]
forall k a. Map k a -> [(k, a)]
Map.toList Map ApName (ApVer, Slot, Metadata)
avs
          SwVer
currentSoftwareVersion <- if [(ApName, (ApVer, Slot, Metadata))] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [(ApName, (ApVer, Slot, Metadata))]
avsList
                                    then SwVer -> GenT Identity SwVer
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SwVer -> GenT Identity SwVer) -> SwVer -> GenT Identity SwVer
forall a b. (a -> b) -> a -> b
$! SwVer
sv'
                                    else (ApName, (ApVer, Slot, Metadata)) -> SwVer
forall b c. (ApName, (ApVer, b, c)) -> SwVer
makeSoftwareVersion ((ApName, (ApVer, Slot, Metadata)) -> SwVer)
-> GenT Identity (ApName, (ApVer, Slot, Metadata))
-> GenT Identity SwVer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [(ApName, (ApVer, Slot, Metadata))]
-> GenT Identity (ApName, (ApVer, Slot, Metadata))
forall (m :: * -> *) a. MonadGen m => [a] -> m a
Gen.element [(ApName, (ApVer, Slot, Metadata))]
avsList

          VKey -> PParams -> ProtVer -> SwVer -> GenT Identity UProp
generateUpdateProposalWith VKey
vk PParams
pps' ProtVer
pv' SwVer
currentSoftwareVersion
        )
      , -- Change protocol and software version.
        (Int
45, VKey -> PParams -> ProtVer -> SwVer -> GenT Identity UProp
generateUpdateProposalWith VKey
vk PParams
pps' ProtVer
pv' SwVer
sv')
      ]

    where
      idGen :: Gen UpId
      idGen :: Gen UpId
idGen = do
        -- Chose an increment for the maximum version seen in the update
        -- proposal IDs.
        Int
inc <- Range Int -> GenT Identity Int
forall (m :: * -> *) a. (MonadGen m, Integral a) => Range a -> m a
Gen.integral (Int -> Int -> Range Int
forall a. a -> a -> Range a
Range.constant Int
1 Int
10)
        case Set UpId -> [UpId]
forall a. Set a -> [a]
Set.toDescList (Set UpId -> [UpId]) -> Set UpId -> [UpId]
forall a b. (a -> b) -> a -> b
$ Map UpId Slot -> Set (Domain (Map UpId Slot))
forall m. (Relation m, Ord (Domain m)) => m -> Set (Domain m)
dom Map UpId Slot
pws of
          [] -> Int -> UpId
UpId (Int -> UpId) -> GenT Identity Int -> Gen UpId
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Int] -> GenT Identity Int
forall (m :: * -> *) a. MonadGen m => [a] -> m a
Gen.element [Int
0 .. Int
inc]
          (UpId Int
maxId:[UpId]
_) -> UpId -> Gen UpId
forall (f :: * -> *) a. Applicative f => a -> f a
pure (UpId -> Gen UpId) -> UpId -> Gen UpId
forall a b. (a -> b) -> a -> b
$ Int -> UpId
UpId (Int
maxId Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
inc)

      -- As issuer we chose a current delegate. The delegation map must not be
      -- empty for this signal generator to succeed.
      issuerGen :: Gen Core.VKey
      issuerGen :: GenT Identity VKey
issuerGen =
        if [VKey] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [VKey]
delegates
        then String -> GenT Identity VKey
forall a. HasCallStack => String -> a
error String
"There are no delegates to issue an update proposal."
        else [VKey] -> GenT Identity VKey
forall (m :: * -> *) a. MonadGen m => [a] -> m a
Gen.element [VKey]
delegates
        where
          delegates :: [VKey]
delegates = Set VKey -> [VKey]
forall a. Set a -> [a]
Set.toList (Bimap VKeyGenesis VKey -> Set (Range (Bimap VKeyGenesis VKey))
forall m. (Relation m, Ord (Range m)) => m -> Set (Range m)
range Bimap VKeyGenesis VKey
dms)

      pparamsGen :: Gen PParams
      pparamsGen :: GenT Identity PParams
pparamsGen = PParams -> GenT Identity PParams
ppsUpdateFrom PParams
pps

      pvGen :: Gen ProtVer
      pvGen :: GenT Identity ProtVer
pvGen =
        (Natural, Natural) -> ProtVer
nextAltVersion ((Natural, Natural) -> ProtVer)
-> GenT Identity (Natural, Natural) -> GenT Identity ProtVer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [(Natural, Natural)] -> GenT Identity (Natural, Natural)
forall (m :: * -> *) a. MonadGen m => [a] -> m a
Gen.element [ (ProtVer -> Natural
_pvMaj ProtVer
pv Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
+ Natural
1, Natural
0)
                                       , (ProtVer -> Natural
_pvMaj ProtVer
pv, ProtVer -> Natural
_pvMin ProtVer
pv Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
+ Natural
1)
                                       ]
        where
          -- Get the next alternate version, alt, so that @(maj, min, alt)@
          -- is not part of the registered protocol-update proposals
          -- (@rpus@).
          nextAltVersion :: (Natural, Natural) -> ProtVer
          nextAltVersion :: (Natural, Natural) -> ProtVer
nextAltVersion (Natural
maj, Natural
mn) = Set (ProtVer, PParams) -> Set (Domain (Set (ProtVer, PParams)))
forall m. (Relation m, Ord (Domain m)) => m -> Set (Domain m)
dom (Map UpId (ProtVer, PParams)
-> Set (Range (Map UpId (ProtVer, PParams)))
forall m. (Relation m, Ord (Range m)) => m -> Set (Range m)
range Map UpId (ProtVer, PParams)
rpus)
                                    Set ProtVer -> (Set ProtVer -> Set ProtVer) -> Set ProtVer
forall a b. a -> (a -> b) -> b
& (ProtVer -> Bool) -> Set ProtVer -> Set ProtVer
forall a. (a -> Bool) -> Set a -> Set a
Set.filter ProtVer -> Bool
protocolVersionEqualsMajMin
                                    Set ProtVer -> (Set ProtVer -> Set Natural) -> Set Natural
forall a b. a -> (a -> b) -> b
& (ProtVer -> Natural) -> Set ProtVer -> Set Natural
forall b a. Ord b => (a -> b) -> Set a -> Set b
Set.map ProtVer -> Natural
_pvAlt
                                    Set Natural -> (Set Natural -> [Natural]) -> [Natural]
forall a b. a -> (a -> b) -> b
& Set Natural -> [Natural]
forall a. Set a -> [a]
Set.toDescList
                                    [Natural] -> ([Natural] -> ProtVer) -> ProtVer
forall a b. a -> (a -> b) -> b
& [Natural] -> ProtVer
nextVersion
            where
              protocolVersionEqualsMajMin :: ProtVer -> Bool
              protocolVersionEqualsMajMin :: ProtVer -> Bool
protocolVersionEqualsMajMin ProtVer
pv' =
                ProtVer -> Natural
_pvMaj ProtVer
pv' Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
maj Bool -> Bool -> Bool
&& ProtVer -> Natural
_pvMin ProtVer
pv' Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
mn

              nextVersion :: [Natural] -> ProtVer
              nextVersion :: [Natural] -> ProtVer
nextVersion [] = Natural -> Natural -> Natural -> ProtVer
ProtVer Natural
maj Natural
mn Natural
0
              nextVersion (Natural
x:[Natural]
_) = Natural -> Natural -> Natural -> ProtVer
ProtVer Natural
maj Natural
mn (Natural
1 Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
+ Natural
x)

      -- Generate a software version update.
      swVerGen :: Gen SwVer
      swVerGen :: GenT Identity SwVer
swVerGen =
        if [(ApName, ApVer)] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [(ApName, ApVer)]
possibleNextVersions
        then GenT Identity SwVer
genNewApp
        else [GenT Identity SwVer] -> GenT Identity SwVer
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice [GenT Identity SwVer
genANextVersion, GenT Identity SwVer
genNewApp]
        where
          possibleNextVersions :: [(ApName, ApVer)]
          possibleNextVersions :: [(ApName, ApVer)]
possibleNextVersions = Set (ApName, ApVer) -> [(ApName, ApVer)]
forall a. Set a -> [a]
Set.toList (Set (ApName, ApVer) -> [(ApName, ApVer)])
-> Set (ApName, ApVer) -> [(ApName, ApVer)]
forall a b. (a -> b) -> a -> b
$ Set (ApName, ApVer)
nextVersions Set (ApName, ApVer) -> Set (ApName, ApVer) -> Set (ApName, ApVer)
forall a. Ord a => Set a -> Set a -> Set a
\\ Set (ApName, ApVer)
registeredNextVersions
            where
              nextVersions :: Set (ApName, ApVer)
              nextVersions :: Set (ApName, ApVer)
nextVersions = [(ApName, ApVer)] -> Set (ApName, ApVer)
forall a. Ord a => [a] -> Set a
Set.fromList ([(ApName, ApVer)] -> Set (ApName, ApVer))
-> [(ApName, ApVer)] -> Set (ApName, ApVer)
forall a b. (a -> b) -> a -> b
$ [ApName] -> [ApVer] -> [(ApName, ApVer)]
forall a b. [a] -> [b] -> [(a, b)]
zip [ApName]
currentAppNames [ApVer]
nextAppVersions
                where
                  ([ApName]
currentAppNames, [(ApVer, Slot, Metadata)]
currentAppVersions) = [(ApName, (ApVer, Slot, Metadata))]
-> ([ApName], [(ApVer, Slot, Metadata)])
forall a b. [(a, b)] -> ([a], [b])
unzip ([(ApName, (ApVer, Slot, Metadata))]
 -> ([ApName], [(ApVer, Slot, Metadata)]))
-> [(ApName, (ApVer, Slot, Metadata))]
-> ([ApName], [(ApVer, Slot, Metadata)])
forall a b. (a -> b) -> a -> b
$ Map ApName (ApVer, Slot, Metadata)
-> [(ApName, (ApVer, Slot, Metadata))]
forall k a. Map k a -> [(k, a)]
Map.toList Map ApName (ApVer, Slot, Metadata)
avs
                  nextAppVersions :: [ApVer]
                  nextAppVersions :: [ApVer]
nextAppVersions = (ApVer -> ApVer -> ApVer
forall a. Num a => a -> a -> a
+ApVer
1) (ApVer -> ApVer)
-> ((ApVer, Slot, Metadata) -> ApVer)
-> (ApVer, Slot, Metadata)
-> ApVer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ApVer, Slot, Metadata) -> ApVer
forall a b c. (a, b, c) -> a
fst3 ((ApVer, Slot, Metadata) -> ApVer)
-> [(ApVer, Slot, Metadata)] -> [ApVer]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [(ApVer, Slot, Metadata)]
currentAppVersions
              registeredNextVersions :: Set (ApName, ApVer)
              registeredNextVersions :: Set (ApName, ApVer)
registeredNextVersions = ((ApName, ApVer, Metadata) -> (ApName, ApVer))
-> Set (ApName, ApVer, Metadata) -> Set (ApName, ApVer)
forall b a. Ord b => (a -> b) -> Set a -> Set b
Set.map ((ApName, ApVer, Metadata) -> ApName
forall a b c. (a, b, c) -> a
fst3 ((ApName, ApVer, Metadata) -> ApName)
-> ((ApName, ApVer, Metadata) -> ApVer)
-> (ApName, ApVer, Metadata)
-> (ApName, ApVer)
forall (a :: * -> * -> *) b c c'.
Arrow a =>
a b c -> a b c' -> a b (c, c')
&&& (ApName, ApVer, Metadata) -> ApVer
forall a b c. (a, b, c) -> b
snd3) (Map UpId (ApName, ApVer, Metadata)
-> Set (Range (Map UpId (ApName, ApVer, Metadata)))
forall m. (Relation m, Ord (Range m)) => m -> Set (Range m)
range Map UpId (ApName, ApVer, Metadata)
raus)

          -- Generate the next version for an existing application
          genANextVersion :: Gen SwVer
          genANextVersion :: GenT Identity SwVer
genANextVersion = (ApName -> ApVer -> SwVer) -> (ApName, ApVer) -> SwVer
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ApName -> ApVer -> SwVer
SwVer ((ApName, ApVer) -> SwVer)
-> GenT Identity (ApName, ApVer) -> GenT Identity SwVer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [(ApName, ApVer)] -> GenT Identity (ApName, ApVer)
forall (m :: * -> *) a. MonadGen m => [a] -> m a
Gen.element [(ApName, ApVer)]
possibleNextVersions

          fst3 :: (a, b, c) -> a
fst3 (a
x, b
_, c
_) = a
x
          snd3 :: (a, b, c) -> b
snd3 (a
_, b
y, c
_) = b
y

          -- Generate a new application
          genNewApp :: Gen SwVer
          genNewApp :: GenT Identity SwVer
genNewApp
            =  (ApName -> ApVer -> SwVer
`SwVer` ApVer
1) (ApName -> SwVer) -> (String -> ApName) -> String -> SwVer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ApName
ApName
           (String -> SwVer) -> GenT Identity String -> GenT Identity SwVer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (String -> Bool) -> GenT Identity String -> GenT Identity String
forall (m :: * -> *) a.
(MonadGen m, GenBase m ~ Identity) =>
(a -> Bool) -> m a -> m a
Gen.filter ((ApName -> Set ApName -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`notElem` Set ApName
usedNames) (ApName -> Bool) -> (String -> ApName) -> String -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ApName
ApName)
                          (Range Int -> GenT Identity Char -> GenT Identity String
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. a -> a -> Range a
Range.constant Int
0 Int
12) GenT Identity Char
forall (m :: * -> *). MonadGen m => m Char
Gen.ascii)
            where
              usedNames :: Set ApName
usedNames = ((ApName, ApVer, Metadata) -> ApName)
-> Set (ApName, ApVer, Metadata) -> Set ApName
forall b a. Ord b => (a -> b) -> Set a -> Set b
Set.map (ApName, ApVer, Metadata) -> ApName
forall a b c. (a, b, c) -> a
fst3 (Map UpId (ApName, ApVer, Metadata)
-> Set (Range (Map UpId (ApName, ApVer, Metadata)))
forall m. (Relation m, Ord (Range m)) => m -> Set (Range m)
range Map UpId (ApName, ApVer, Metadata)
raus)
                          Set ApName -> Set ApName -> Set ApName
forall a. Ord a => Set a -> Set a -> Set a
`union`
                          Map ApName (ApVer, Slot, Metadata)
-> Set (Domain (Map ApName (ApVer, Slot, Metadata)))
forall m. (Relation m, Ord (Domain m)) => m -> Set (Domain m)
dom Map ApName (ApVer, Slot, Metadata)
avs

      generateUpdateProposalWith
        :: VKey
        -> PParams
        -> ProtVer
        -> SwVer
        -> Gen UProp
      generateUpdateProposalWith :: VKey -> PParams -> ProtVer -> SwVer -> GenT Identity UProp
generateUpdateProposalWith VKey
vk PParams
pps' ProtVer
pv' SwVer
sv'
        = UpId
-> VKey
-> ProtVer
-> PParams
-> SwVer
-> Set String
-> Metadata
-> UProp
mkUProp
        (UpId
 -> VKey
 -> ProtVer
 -> PParams
 -> SwVer
 -> Set String
 -> Metadata
 -> UProp)
-> Gen UpId
-> GenT
     Identity
     (VKey
      -> ProtVer -> PParams -> SwVer -> Set String -> Metadata -> UProp)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Gen UpId
idGen
        GenT
  Identity
  (VKey
   -> ProtVer -> PParams -> SwVer -> Set String -> Metadata -> UProp)
-> GenT Identity VKey
-> GenT
     Identity
     (ProtVer -> PParams -> SwVer -> Set String -> Metadata -> UProp)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> VKey -> GenT Identity VKey
forall (f :: * -> *) a. Applicative f => a -> f a
pure VKey
vk
        GenT
  Identity
  (ProtVer -> PParams -> SwVer -> Set String -> Metadata -> UProp)
-> GenT Identity ProtVer
-> GenT
     Identity (PParams -> SwVer -> Set String -> Metadata -> UProp)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ProtVer -> GenT Identity ProtVer
forall (f :: * -> *) a. Applicative f => a -> f a
pure ProtVer
pv'
        GenT Identity (PParams -> SwVer -> Set String -> Metadata -> UProp)
-> GenT Identity PParams
-> GenT Identity (SwVer -> Set String -> Metadata -> UProp)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> PParams -> GenT Identity PParams
forall (f :: * -> *) a. Applicative f => a -> f a
pure PParams
pps'
        GenT Identity (SwVer -> Set String -> Metadata -> UProp)
-> GenT Identity SwVer
-> GenT Identity (Set String -> Metadata -> UProp)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> SwVer -> GenT Identity SwVer
forall (f :: * -> *) a. Applicative f => a -> f a
pure SwVer
sv'
        GenT Identity (Set String -> Metadata -> UProp)
-> GenT Identity (Set String) -> GenT Identity (Metadata -> UProp)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity (Set String)
stTagsGen
        GenT Identity (Metadata -> UProp)
-> GenT Identity Metadata -> GenT Identity UProp
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity Metadata
mdtGen

      stTagsGen :: Gen (Set STag)
      stTagsGen :: GenT Identity (Set String)
stTagsGen =
        -- TODO: We need to benchmark this against @Gen.set@. This seems to be
        -- slightly faster.
        Context -> Set String
forall a. Ord a => [a] -> Set a
Set.fromList (Context -> Set String)
-> GenT Identity Context -> GenT Identity (Set String)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
          Range Int -> GenT Identity String -> GenT Identity Context
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 Int
5) (Range Int -> GenT Identity Char -> GenT Identity String
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. a -> a -> Range a
Range.constant Int
0 Int
10) GenT Identity Char
forall (m :: * -> *). MonadGen m => m Char
Gen.ascii)

      mdtGen :: Gen Metadata
      mdtGen :: GenT Identity Metadata
mdtGen = Metadata -> GenT Identity Metadata
forall (f :: * -> *) a. Applicative f => a -> f a
pure Metadata
Metadata


upiEnvGen :: Gen UPIEnv
upiEnvGen :: Gen UPIEnv
upiEnvGen = do
    Word8
ngk <- Range Word8 -> GenT Identity Word8
forall (m :: * -> *) a. (MonadGen m, Integral a) => Range a -> m a
Gen.integral (Word8 -> Word8 -> Range Word8
forall a. Integral a => a -> a -> Range a
Range.linear Word8
1 Word8
14)
    (,,,)
      (Slot -> Bimap VKeyGenesis VKey -> BlockCount -> Word8 -> UPIEnv)
-> GenT Identity Slot
-> GenT
     Identity (Bimap VKeyGenesis VKey -> BlockCount -> Word8 -> UPIEnv)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Word64 -> Word64 -> GenT Identity Slot
CoreGen.slotGen Word64
0 Word64
10 -- Current slot
      GenT
  Identity (Bimap VKeyGenesis VKey -> BlockCount -> Word8 -> UPIEnv)
-> GenT Identity (Bimap VKeyGenesis VKey)
-> GenT Identity (BlockCount -> Word8 -> UPIEnv)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Word8 -> GenT Identity (Bimap VKeyGenesis VKey)
dmapGen Word8
ngk  -- Delegation map
      GenT Identity (BlockCount -> Word8 -> UPIEnv)
-> GenT Identity BlockCount -> GenT Identity (Word8 -> UPIEnv)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Word64 -> BlockCount
BlockCount (Word64 -> BlockCount)
-> GenT Identity Word64 -> GenT Identity BlockCount
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Range Word64 -> GenT Identity Word64
forall (m :: * -> *). MonadGen m => Range Word64 -> m Word64
Gen.word64 (Word64 -> Word64 -> Range Word64
forall a. a -> a -> Range a
Range.constant Word64
0 Word64
100)) -- Chain stability parameter (k)
      GenT Identity (Word8 -> UPIEnv)
-> GenT Identity Word8 -> Gen UPIEnv
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Word8 -> GenT Identity Word8
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word8
ngk

-- Generate an initial delegation map, using a constant number of genesis
-- keys, which is determined in this generator.
dmapGen :: Word8 -> Gen (Bimap Core.VKeyGenesis Core.VKey)
dmapGen :: Word8 -> GenT Identity (Bimap VKeyGenesis VKey)
dmapGen Word8
ngk = [(VKeyGenesis, VKey)] -> Bimap VKeyGenesis VKey
forall a b. (Ord a, Ord b) => [(a, b)] -> Bimap a b
Bimap.fromList ([(VKeyGenesis, VKey)] -> Bimap VKeyGenesis VKey)
-> (([VKeyGenesis], [VKey]) -> [(VKeyGenesis, VKey)])
-> ([VKeyGenesis], [VKey])
-> Bimap VKeyGenesis VKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([VKeyGenesis] -> [VKey] -> [(VKeyGenesis, VKey)])
-> ([VKeyGenesis], [VKey]) -> [(VKeyGenesis, VKey)]
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry [VKeyGenesis] -> [VKey] -> [(VKeyGenesis, VKey)]
forall a b. [a] -> [b] -> [(a, b)]
zip (([VKeyGenesis], [VKey]) -> Bimap VKeyGenesis VKey)
-> GenT Identity ([VKeyGenesis], [VKey])
-> GenT Identity (Bimap VKeyGenesis VKey)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT Identity ([VKeyGenesis], [VKey])
vkgVkPairsGen
  where
    vkgVkPairsGen :: Gen ([Core.VKeyGenesis], [Core.VKey])
    vkgVkPairsGen :: GenT Identity ([VKeyGenesis], [VKey])
vkgVkPairsGen = ([VKeyGenesis]
vkgs,) ([VKey] -> ([VKeyGenesis], [VKey]))
-> GenT Identity [VKey] -> GenT Identity ([VKeyGenesis], [VKey])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ([VKey] -> Bool) -> GenT Identity [VKey] -> GenT Identity [VKey]
forall (m :: * -> *) a.
(MonadGen m, GenBase m ~ Identity) =>
(a -> Bool) -> m a -> m a
Gen.filter (Bool -> Bool
not (Bool -> Bool) -> ([VKey] -> Bool) -> [VKey] -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [VKey] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null) ([VKey] -> GenT Identity [VKey]
forall (m :: * -> *) a. MonadGen m => [a] -> m [a]
Gen.subsequence [VKey]
vks)
      where
        vkgs :: [VKeyGenesis]
vkgs = VKey -> VKeyGenesis
VKeyGenesis (VKey -> VKeyGenesis) -> (Word8 -> VKey) -> Word8 -> VKeyGenesis
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Owner -> VKey
VKey (Owner -> VKey) -> (Word8 -> Owner) -> Word8 -> VKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Natural -> Owner
Owner (Natural -> Owner) -> (Word8 -> Natural) -> Word8 -> Owner
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Natural
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> VKeyGenesis) -> [Word8] -> [VKeyGenesis]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Word8
0 .. Word8
ngk Word8 -> Word8 -> Word8
forall a. Num a => a -> a -> a
- Word8
1]
        -- As delegation targets we choose twice the number of genesis keys.
        -- Note that the genesis keys can delegate to themselves in the
        -- generated delegation map.
        vks :: [VKey]
vks = Owner -> VKey
VKey (Owner -> VKey) -> (Word8 -> Owner) -> Word8 -> VKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Natural -> Owner
Owner (Natural -> Owner) -> (Word8 -> Natural) -> Word8 -> Owner
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Natural
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word8 -> VKey) -> [Word8] -> [VKey]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Word8
0 .. Word8
2 Word8 -> Word8 -> Word8
forall a. Num a => a -> a -> a
* (Word8
ngk Word8 -> Word8 -> Word8
forall a. Num a => a -> a -> a
- Word8
1)]

-- | Generate a protocol parameter update from a given set of current
-- protocol-parameters, ensuring the consistency of the new protocol parameters
-- w.r.t. the current ones, according to the @canUpdate@ predicate in the
-- formal specification.
--
-- TODO: we can move this into a Generator's module, but first we need to
-- disentangle the dependencies. Moving this to @Byron.Spec.Ledger.Update.Generators@ will
-- cause a circular dependency. I think the rules need to be moved into their
-- own modules.
ppsUpdateFrom :: PParams -> Gen PParams
ppsUpdateFrom :: PParams -> GenT Identity PParams
ppsUpdateFrom PParams
pps = do
  -- NOTE: we only generate small changes in the parameters to avoid leaving the
  -- protocol parameters in a state that won't allow to produce any valid blocks
  -- anymore (for instance if the maximum block size drops to a very small
  -- value).

  -- Determine the change in the block size: a decrement or an increment that
  -- is no more than twice the current block maximum size.
  --
  -- We don't expect the maximum block size to change often, so we generate
  -- more values around the current block size (@_maxBkSz@).
  Natural
newMaxBkSize <-
    Range Natural -> GenT Identity Natural
forall (m :: * -> *) a. (MonadGen m, Integral a) => Range a -> m a
Gen.integral (Natural -> Natural -> Natural -> Range Natural
forall a. Integral a => a -> a -> a -> Range a
Range.linearFrom
                    Natural
_maxBkSz
                    (Natural
_maxBkSz Natural -> Natural -> Natural
-? Natural
100) -- Decrement value was determined ad-hoc
                    (Natural
2 Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
* Natural
_maxBkSz)
                 )
    GenT Identity Natural
-> (Natural, Natural) -> GenT Identity Natural
forall a. Gen a -> (a, a) -> Gen a
`increasingProbabilityAt` (Natural
_maxBkSz Natural -> Natural -> Natural
-? Natural
100, Natural
2 Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
* Natural
_maxBkSz)

  -- Similarly, we don't expect the transaction size to be changed often, so we
  -- also generate more values around the current maximum transaction size.
  let minTxSzBound :: Natural
minTxSzBound = Natural
_maxTxSz Natural -> Natural -> Natural
forall a. Ord a => a -> a -> a
`min` Natural
newMaxBkSize Natural -> Natural -> Natural
-? Natural
1
  Natural
newMaxTxSize <-
    Range Natural -> GenT Identity Natural
forall (m :: * -> *) a. (MonadGen m, Integral a) => Range a -> m a
Gen.integral (Natural -> Natural -> Range Natural
forall a. Integral a => a -> a -> Range a
Range.exponential
                    (Natural
minTxSzBound Natural -> Natural -> Natural
-? Natural
10) -- Decrement value determined ad-hoc
                    (Natural
newMaxBkSize Natural -> Natural -> Natural
-? Natural
1)
                 )

  Natural
-> Natural
-> Natural
-> Natural
-> BkSgnCntT
-> SlotCount
-> SlotCount
-> Natural
-> UpAdptThd
-> FactorA
-> FactorB
-> PParams
PParams
    (Natural
 -> Natural
 -> Natural
 -> Natural
 -> BkSgnCntT
 -> SlotCount
 -> SlotCount
 -> Natural
 -> UpAdptThd
 -> FactorA
 -> FactorB
 -> PParams)
-> GenT Identity Natural
-> GenT
     Identity
     (Natural
      -> Natural
      -> Natural
      -> BkSgnCntT
      -> SlotCount
      -> SlotCount
      -> Natural
      -> UpAdptThd
      -> FactorA
      -> FactorB
      -> PParams)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Natural -> GenT Identity Natural
forall (f :: * -> *) a. Applicative f => a -> f a
pure Natural
newMaxBkSize
    GenT
  Identity
  (Natural
   -> Natural
   -> Natural
   -> BkSgnCntT
   -> SlotCount
   -> SlotCount
   -> Natural
   -> UpAdptThd
   -> FactorA
   -> FactorB
   -> PParams)
-> GenT Identity Natural
-> GenT
     Identity
     (Natural
      -> Natural
      -> BkSgnCntT
      -> SlotCount
      -> SlotCount
      -> Natural
      -> UpAdptThd
      -> FactorA
      -> FactorB
      -> PParams)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity Natural
nextMaxHdrSzGen
    GenT
  Identity
  (Natural
   -> Natural
   -> BkSgnCntT
   -> SlotCount
   -> SlotCount
   -> Natural
   -> UpAdptThd
   -> FactorA
   -> FactorB
   -> PParams)
-> GenT Identity Natural
-> GenT
     Identity
     (Natural
      -> BkSgnCntT
      -> SlotCount
      -> SlotCount
      -> Natural
      -> UpAdptThd
      -> FactorA
      -> FactorB
      -> PParams)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Natural -> GenT Identity Natural
forall (f :: * -> *) a. Applicative f => a -> f a
pure Natural
newMaxTxSize
    GenT
  Identity
  (Natural
   -> BkSgnCntT
   -> SlotCount
   -> SlotCount
   -> Natural
   -> UpAdptThd
   -> FactorA
   -> FactorB
   -> PParams)
-> GenT Identity Natural
-> GenT
     Identity
     (BkSgnCntT
      -> SlotCount
      -> SlotCount
      -> Natural
      -> UpAdptThd
      -> FactorA
      -> FactorB
      -> PParams)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity Natural
nextMaxPropSz
    GenT
  Identity
  (BkSgnCntT
   -> SlotCount
   -> SlotCount
   -> Natural
   -> UpAdptThd
   -> FactorA
   -> FactorB
   -> PParams)
-> GenT Identity BkSgnCntT
-> GenT
     Identity
     (SlotCount
      -> SlotCount
      -> Natural
      -> UpAdptThd
      -> FactorA
      -> FactorB
      -> PParams)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity BkSgnCntT
nextBkSgnCntT
    GenT
  Identity
  (SlotCount
   -> SlotCount
   -> Natural
   -> UpAdptThd
   -> FactorA
   -> FactorB
   -> PParams)
-> GenT Identity SlotCount
-> GenT
     Identity
     (SlotCount
      -> Natural -> UpAdptThd -> FactorA -> FactorB -> PParams)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> SlotCount -> GenT Identity SlotCount
forall (f :: * -> *) a. Applicative f => a -> f a
pure SlotCount
_bkSlotsPerEpoch -- This parameter should be removed from 'PParams'
    GenT
  Identity
  (SlotCount
   -> Natural -> UpAdptThd -> FactorA -> FactorB -> PParams)
-> GenT Identity SlotCount
-> GenT
     Identity (Natural -> UpAdptThd -> FactorA -> FactorB -> PParams)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity SlotCount
nextUpTtl
    GenT
  Identity (Natural -> UpAdptThd -> FactorA -> FactorB -> PParams)
-> GenT Identity Natural
-> GenT Identity (UpAdptThd -> FactorA -> FactorB -> PParams)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity Natural
nextScriptVersion
    GenT Identity (UpAdptThd -> FactorA -> FactorB -> PParams)
-> GenT Identity UpAdptThd
-> GenT Identity (FactorA -> FactorB -> PParams)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity UpAdptThd
nextUpAdptThd
    GenT Identity (FactorA -> FactorB -> PParams)
-> GenT Identity FactorA -> GenT Identity (FactorB -> PParams)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity FactorA
nextFactorA
    GenT Identity (FactorB -> PParams)
-> GenT Identity FactorB -> GenT Identity PParams
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT Identity FactorB
nextFactorB

  where
    PParams{ Natural
_maxBkSz :: Natural
_maxBkSz :: PParams -> Natural
_maxBkSz
           , Natural
_maxHdrSz :: Natural
_maxHdrSz :: PParams -> Natural
_maxHdrSz
           , Natural
_maxTxSz :: Natural
_maxTxSz :: PParams -> Natural
_maxTxSz
           , Natural
_maxPropSz :: Natural
_maxPropSz :: PParams -> Natural
_maxPropSz
           , BkSgnCntT
_bkSgnCntT :: BkSgnCntT
_bkSgnCntT :: PParams -> BkSgnCntT
_bkSgnCntT
           , SlotCount
_bkSlotsPerEpoch :: SlotCount
_bkSlotsPerEpoch :: PParams -> SlotCount
_bkSlotsPerEpoch
           , SlotCount
_upTtl :: SlotCount
_upTtl :: PParams -> SlotCount
_upTtl
           , Natural
_scriptVersion :: Natural
_scriptVersion :: PParams -> Natural
_scriptVersion
           , UpAdptThd
_upAdptThd :: UpAdptThd
_upAdptThd :: PParams -> UpAdptThd
_upAdptThd
           , FactorA
_factorA :: FactorA
_factorA :: PParams -> FactorA
_factorA
           , FactorB
_factorB :: FactorB
_factorB :: PParams -> FactorB
_factorB
           } = PParams
pps

    FactorA Int
fA = FactorA
_factorA
    FactorB Int
fB = FactorB
_factorB
    BkSgnCntT Double
bsct = BkSgnCntT
_bkSgnCntT
    UpAdptThd Double
uat = UpAdptThd
_upAdptThd

    nextMaxHdrSzGen :: Gen Natural
    nextMaxHdrSzGen :: GenT Identity Natural
nextMaxHdrSzGen =
      Range Natural -> GenT Identity Natural
forall (m :: * -> *) a. (MonadGen m, Integral a) => Range a -> m a
Gen.integral (Natural -> Natural -> Natural -> Range Natural
forall a. Integral a => a -> a -> a -> Range a
Range.exponentialFrom
                      Natural
_maxHdrSz
                      (Natural
_maxHdrSz Natural -> Natural -> Natural
-? Natural
10)
                      (Natural
2 Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
* Natural
_maxHdrSz)
                   )

    nextMaxPropSz :: Gen Natural
    nextMaxPropSz :: GenT Identity Natural
nextMaxPropSz =
      Range Natural -> GenT Identity Natural
forall (m :: * -> *) a. (MonadGen m, Integral a) => Range a -> m a
Gen.integral (Natural -> Natural -> Natural -> Range Natural
forall a. Integral a => a -> a -> a -> Range a
Range.exponentialFrom
                      Natural
_maxPropSz
                      (Natural
_maxPropSz Natural -> Natural -> Natural
-? Natural
1)
                      (Natural
2 Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
* Natural
_maxPropSz)
                   )

    nextBkSgnCntT :: Gen BkSgnCntT
    nextBkSgnCntT :: GenT Identity BkSgnCntT
nextBkSgnCntT = Double -> BkSgnCntT
BkSgnCntT (Double -> BkSgnCntT)
-> GenT Identity Double -> GenT Identity BkSgnCntT
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
      Range Double -> GenT Identity Double
forall (m :: * -> *). MonadGen m => Range Double -> m Double
Gen.double (Double -> Double -> Double -> Range Double
forall a. (Floating a, Ord a) => a -> a -> a -> Range a
Range.exponentialFloatFrom
                    Double
bsct
                    (Double
bsct Double -> Double ->