| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.HardFork.Combinator.Degenerate
Contents
Synopsis
- data HardForkBlock xs where
- pattern DegenBlock :: forall b. NoHardForks b => b -> HardForkBlock '[b]
- data family Header blk :: Type
- data family GenTx blk :: Type
- data family TxId tx :: Type
- data HardForkApplyTxErr xs where
- pattern DegenApplyTxErr :: forall b. NoHardForks b => ApplyTxErr b -> HardForkApplyTxErr '[b]
- data HardForkLedgerError xs where
- pattern DegenLedgerError :: forall b. NoHardForks b => LedgerError b -> HardForkLedgerError '[b]
- data HardForkEnvelopeErr xs where
- pattern DegenOtherHeaderEnvelopeError :: forall b. NoHardForks b => OtherHeaderEnvelopeError b -> HardForkEnvelopeErr '[b]
- data OneEraTipInfo xs where
- pattern DegenTipInfo :: forall b. NoHardForks b => TipInfo b -> OneEraTipInfo '[b]
- data family Query blk :: Type -> Type
- data Either a b where
- pattern DegenQueryResult :: result -> HardForkQueryResult '[b] result
- data family CodecConfig blk :: Type
- data family BlockConfig blk :: Type
- data family ConsensusConfig p :: Type
- data HardForkLedgerConfig xs where
- pattern DegenLedgerConfig :: PartialLedgerConfig b -> HardForkLedgerConfig '[b]
- data TopLevelConfig blk where
- pattern DegenTopLevelConfig :: NoHardForks b => TopLevelConfig b -> TopLevelConfig (HardForkBlock '[b])
- data family LedgerState blk :: Type
Pattern synonyms
data HardForkBlock xs where Source #
Bundled Patterns
| pattern DegenBlock :: forall b. NoHardForks b => b -> HardForkBlock '[b] |
Instances
data family Header blk :: Type Source #
Instances
data family GenTx blk :: Type Source #
Generalized transaction
The mempool (and, accordingly, blocks) consist of "generalized transactions"; this could be "proper" transactions (transferring funds) but also other kinds of things such as update proposals, delegations, etc.
Instances
data family TxId tx :: Type Source #
A generalized transaction, GenTx, identifier.
Instances
data HardForkApplyTxErr xs where Source #
Bundled Patterns
| pattern DegenApplyTxErr :: forall b. NoHardForks b => ApplyTxErr b -> HardForkApplyTxErr '[b] |
Instances
data HardForkLedgerError xs where Source #
Bundled Patterns
| pattern DegenLedgerError :: forall b. NoHardForks b => LedgerError b -> HardForkLedgerError '[b] |
Instances
data HardForkEnvelopeErr xs where Source #
Bundled Patterns
| pattern DegenOtherHeaderEnvelopeError :: forall b. NoHardForks b => OtherHeaderEnvelopeError b -> HardForkEnvelopeErr '[b] |
Instances
data OneEraTipInfo xs where Source #
Bundled Patterns
| pattern DegenTipInfo :: forall b. NoHardForks b => TipInfo b -> OneEraTipInfo '[b] |
Instances
| CanHardFork xs => Eq (OneEraTipInfo xs) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.AcrossEras Methods (==) :: OneEraTipInfo xs -> OneEraTipInfo xs -> Bool # (/=) :: OneEraTipInfo xs -> OneEraTipInfo xs -> Bool # | |
| CanHardFork xs => Show (OneEraTipInfo xs) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.AcrossEras Methods showsPrec :: Int -> OneEraTipInfo xs -> ShowS # show :: OneEraTipInfo xs -> String # showList :: [OneEraTipInfo xs] -> ShowS # | |
| CanHardFork xs => NoThunks (OneEraTipInfo xs) Source # | |
data family Query blk :: Type -> Type Source #
Different queries supported by the ledger, indexed by the result type.
Instances
The Either type represents values with two possibilities: a value of
type is either Either a b or Left a.Right b
The Either type is sometimes used to represent a value which is
either correct or an error; by convention, the Left constructor is
used to hold an error value and the Right constructor is used to
hold a correct value (mnemonic: "right" also means "correct").
Examples
The type is the type of values which can be either
a Either String IntString or an Int. The Left constructor can be used only on
Strings, and the Right constructor can be used only on Ints:
>>>let s = Left "foo" :: Either String Int>>>sLeft "foo">>>let n = Right 3 :: Either String Int>>>nRight 3>>>:type ss :: Either String Int>>>:type nn :: Either String Int
The fmap from our Functor instance will ignore Left values, but
will apply the supplied function to values contained in a Right:
>>>let s = Left "foo" :: Either String Int>>>let n = Right 3 :: Either String Int>>>fmap (*2) sLeft "foo">>>fmap (*2) nRight 6
The Monad instance for Either allows us to chain together multiple
actions which may fail, and fail overall if any of the individual
steps failed. First we'll write a function that can either parse an
Int from a Char, or fail.
>>>import Data.Char ( digitToInt, isDigit )>>>:{let parseEither :: Char -> Either String Int parseEither c | isDigit c = Right (digitToInt c) | otherwise = Left "parse error">>>:}
The following should work, since both '1' and '2' can be
parsed as Ints.
>>>:{let parseMultiple :: Either String Int parseMultiple = do x <- parseEither '1' y <- parseEither '2' return (x + y)>>>:}
>>>parseMultipleRight 3
But the following should fail overall, since the first operation where
we attempt to parse 'm' as an Int will fail:
>>>:{let parseMultiple :: Either String Int parseMultiple = do x <- parseEither 'm' y <- parseEither '2' return (x + y)>>>:}
>>>parseMultipleLeft "parse error"
Bundled Patterns
| pattern DegenQueryResult :: result -> HardForkQueryResult '[b] result |
Instances
| Bifunctor Either | Since: base-4.8.0.0 |
| Bitraversable Either | Since: base-4.10.0.0 |
Defined in Data.Bitraversable Methods bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Either a b -> f (Either c d) # | |
| Bifoldable Either | Since: base-4.10.0.0 |
| Eq2 Either | Since: base-4.9.0.0 |
| Ord2 Either | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
| Read2 Either | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes Methods liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (Either a b) # liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Either a b] # liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (Either a b) # liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [Either a b] # | |
| Show2 Either | Since: base-4.9.0.0 |
| NFData2 Either | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
| Hashable2 Either | |
| MonadError e (Either e) | |
Defined in Control.Monad.Error.Class | |
| (Lift a, Lift b) => Lift (Either a b :: Type) | |
| Monad (Either e) | Since: base-4.4.0.0 |
| Functor (Either a) | Since: base-3.0 |
| MonadFix (Either e) | Since: base-4.3.0.0 |
Defined in Control.Monad.Fix | |
| Applicative (Either e) | Since: base-3.0 |
| Foldable (Either a) | Since: base-4.7.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => Either a m -> m # foldMap :: Monoid m => (a0 -> m) -> Either a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Either a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Either a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Either a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Either a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Either a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Either a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Either a a0 -> a0 # toList :: Either a a0 -> [a0] # length :: Either a a0 -> Int # elem :: Eq a0 => a0 -> Either a a0 -> Bool # maximum :: Ord a0 => Either a a0 -> a0 # minimum :: Ord a0 => Either a a0 -> a0 # | |
| Traversable (Either a) | Since: base-4.7.0.0 |
Defined in Data.Traversable | |
| Eq a => Eq1 (Either a) | Since: base-4.9.0.0 |
| Ord a => Ord1 (Either a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
| Read a => Read1 (Either a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes Methods liftReadsPrec :: (Int -> ReadS a0) -> ReadS [a0] -> Int -> ReadS (Either a a0) # liftReadList :: (Int -> ReadS a0) -> ReadS [a0] -> ReadS [Either a a0] # liftReadPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec (Either a a0) # liftReadListPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec [Either a a0] # | |
| Show a => Show1 (Either a) | Since: base-4.9.0.0 |
| MonadFailure (Either a) | |
| NFData a => NFData1 (Either a) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
| e ~ SomeException => MonadThrow (Either e) | |
Defined in Control.Monad.Catch | |
| e ~ SomeException => MonadCatch (Either e) | Since: exceptions-0.8.3 |
| e ~ SomeException => MonadMask (Either e) | Since: exceptions-0.8.3 |
Defined in Control.Monad.Catch | |
| Hashable a => Hashable1 (Either a) | |
Defined in Data.Hashable.Class | |
| Generic1 (Either a :: Type -> Type) | Since: base-4.6.0.0 |
| (Eq a, Eq b) => Eq (Either a b) | Since: base-2.1 |
| (Ord a, Ord b) => Ord (Either a b) | Since: base-2.1 |
| (Read a, Read b) => Read (Either a b) | Since: base-3.0 |
| (Show a, Show b) => Show (Either a b) | Since: base-3.0 |
| Generic (Either a b) | Since: base-4.6.0.0 |
| Semigroup (Either a b) | Since: base-4.9.0.0 |
| (NFData a, NFData b) => NFData (Either a b) | |
Defined in Control.DeepSeq | |
| (Hashable a, Hashable b) => Hashable (Either a b) | |
| (Binary a, Binary b) => Binary (Either a b) | |
| (FromCBOR a, FromCBOR b) => FromCBOR (Either a b) | |
| (NoThunks a, NoThunks b) => NoThunks (Either a b) | |
| Recursive (Either a b) | |
Defined in Data.Functor.Foldable Methods project :: Either a b -> Base (Either a b) (Either a b) Source # cata :: (Base (Either a b) a0 -> a0) -> Either a b -> a0 Source # para :: (Base (Either a b) (Either a b, a0) -> a0) -> Either a b -> a0 Source # gpara :: (Corecursive (Either a b), Comonad w) => (forall b0. Base (Either a b) (w b0) -> w (Base (Either a b) b0)) -> (Base (Either a b) (EnvT (Either a b) w a0) -> a0) -> Either a b -> a0 Source # prepro :: Corecursive (Either a b) => (forall b0. Base (Either a b) b0 -> Base (Either a b) b0) -> (Base (Either a b) a0 -> a0) -> Either a b -> a0 Source # gprepro :: (Corecursive (Either a b), Comonad w) => (forall b0. Base (Either a b) (w b0) -> w (Base (Either a b) b0)) -> (forall c. Base (Either a b) c -> Base (Either a b) c) -> (Base (Either a b) (w a0) -> a0) -> Either a b -> a0 Source # | |
| Corecursive (Either a b) | |
Defined in Data.Functor.Foldable Methods embed :: Base (Either a b) (Either a b) -> Either a b Source # ana :: (a0 -> Base (Either a b) a0) -> a0 -> Either a b Source # apo :: (a0 -> Base (Either a b) (Either (Either a b) a0)) -> a0 -> Either a b Source # postpro :: Recursive (Either a b) => (forall b0. Base (Either a b) b0 -> Base (Either a b) b0) -> (a0 -> Base (Either a b) a0) -> a0 -> Either a b Source # gpostpro :: (Recursive (Either a b), Monad m) => (forall b0. m (Base (Either a b) b0) -> Base (Either a b) (m b0)) -> (forall c. Base (Either a b) c -> Base (Either a b) c) -> (a0 -> Base (Either a b) (m a0)) -> a0 -> Either a b Source # | |
| (Serialise a, Serialise b) => Serialise (Either a b) | Since: serialise-0.2.0.0 |
| type Failure (Either a) | |
Defined in Basement.Monad | |
| type Rep1 (Either a :: Type -> Type) | |
Defined in GHC.Generics type Rep1 (Either a :: Type -> Type) = D1 ('MetaData "Either" "Data.Either" "base" 'False) (C1 ('MetaCons "Left" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: C1 ('MetaCons "Right" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1)) | |
| type Rep (Either a b) | |
Defined in GHC.Generics type Rep (Either a b) = D1 ('MetaData "Either" "Data.Either" "base" 'False) (C1 ('MetaCons "Left" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: C1 ('MetaCons "Right" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 b))) | |
| type Base (Either a b) | Example boring stub for non-recursive data types |
data family CodecConfig blk :: Type Source #
Static configuration required for serialisation and deserialisation of types pertaining to this type of block.
Data family instead of type family to get better type inference.
Instances
data family BlockConfig blk :: Type Source #
Static configuration required to work with this type of blocks
Instances
| Isomorphic BlockConfig Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Unary Methods project :: NoHardForks blk => BlockConfig (HardForkBlock '[blk]) -> BlockConfig blk Source # inject :: NoHardForks blk => BlockConfig blk -> BlockConfig (HardForkBlock '[blk]) Source # | |
| NoThunks (BlockConfig (DualBlock m a)) Source # | |
| CanHardFork xs => NoThunks (BlockConfig (HardForkBlock xs)) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Basics Methods noThunks :: Context -> BlockConfig (HardForkBlock xs) -> IO (Maybe ThunkInfo) Source # wNoThunks :: Context -> BlockConfig (HardForkBlock xs) -> IO (Maybe ThunkInfo) Source # showTypeOf :: Proxy (BlockConfig (HardForkBlock xs)) -> String Source # | |
| newtype BlockConfig (HardForkBlock xs) Source # | |
| data BlockConfig (DualBlock m a) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual | |
data family ConsensusConfig p :: Type Source #
Static configuration required to run the consensus protocol
Every method in the ConsensusProtocol class takes the consensus
configuration as a parameter, so having this as a data family rather than a
type family resolves most ambiguity.
Defined out of the class so that protocols can define this type without having to define the entire protocol at the same time (or indeed in the same module).
Instances
data HardForkLedgerConfig xs where Source #
Bundled Patterns
| pattern DegenLedgerConfig :: PartialLedgerConfig b -> HardForkLedgerConfig '[b] |
Instances
| Generic (HardForkLedgerConfig xs) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Basics Associated Types type Rep (HardForkLedgerConfig xs) :: Type -> Type # Methods from :: HardForkLedgerConfig xs -> Rep (HardForkLedgerConfig xs) x # to :: Rep (HardForkLedgerConfig xs) x -> HardForkLedgerConfig xs # | |
| CanHardFork xs => NoThunks (HardForkLedgerConfig xs) Source # | |
| type Rep (HardForkLedgerConfig xs) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Basics type Rep (HardForkLedgerConfig xs) = D1 ('MetaData "HardForkLedgerConfig" "Ouroboros.Consensus.HardFork.Combinator.Basics" "ouroboros-consensus-0.1.0.0-GfJNvFcM6lj2s5utKAUPEp" 'False) (C1 ('MetaCons "HardForkLedgerConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "hardForkLedgerConfigShape") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Shape xs)) :*: S1 ('MetaSel ('Just "hardForkLedgerConfigPerEra") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PerEraLedgerConfig xs)))) | |
data TopLevelConfig blk where Source #
The top-level node configuration
Bundled Patterns
| pattern DegenTopLevelConfig :: NoHardForks b => TopLevelConfig b -> TopLevelConfig (HardForkBlock '[b]) |
Instances
data family LedgerState blk :: Type Source #
Ledger state associated with a block