Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data family BlockConfig blk :: Type
- data family BlockQuery blk :: Type -> Type
- data family CodecConfig blk :: Type
- data family ConsensusConfig p :: Type
-
data
Either
a b
where
- pattern DegenQueryResult :: result -> HardForkQueryResult '[b] result
- data family GenTx blk :: Type
-
data
HardForkApplyTxErr
xs
where
- pattern DegenApplyTxErr :: forall b. NoHardForks b => ApplyTxErr b -> HardForkApplyTxErr '[b]
-
data
HardForkBlock
xs
where
- pattern DegenBlock :: forall b. NoHardForks b => b -> HardForkBlock '[b]
-
data
HardForkEnvelopeErr
xs
where
- pattern DegenOtherHeaderEnvelopeError :: forall b. NoHardForks b => OtherHeaderEnvelopeError b -> HardForkEnvelopeErr '[b]
-
data
HardForkLedgerConfig
xs
where
- pattern DegenLedgerConfig :: PartialLedgerConfig b -> HardForkLedgerConfig '[b]
-
data
HardForkLedgerError
xs
where
- pattern DegenLedgerError :: forall b. NoHardForks b => LedgerError b -> HardForkLedgerError '[b]
- data family Header blk :: Type
- data family LedgerState blk :: Type
-
data
OneEraTipInfo
xs
where
- pattern DegenTipInfo :: forall b. NoHardForks b => TipInfo b -> OneEraTipInfo '[b]
-
data
TopLevelConfig
blk
where
- pattern DegenTopLevelConfig :: NoHardForks b => TopLevelConfig b -> TopLevelConfig ( HardForkBlock '[b])
- data family TxId tx :: Type
Pattern synonyms
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.Embed.Unary 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 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 BlockQuery blk :: Type -> Type Source #
Different queries supported by the ledger, indexed by the result type.
Instances
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 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 Either a b where Source #
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
Int
String
or an
Int
. The
Left
constructor can be used only on
String
s, and the
Right
constructor can be used only on
Int
s:
>>>
let s = Left "foo" :: Either String Int
>>>
s
Left "foo">>>
let n = Right 3 :: Either String Int
>>>
n
Right 3>>>
:type s
s :: Either String Int>>>
:type n
n :: 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) s
Left "foo">>>
fmap (*2) n
Right 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
Int
s.
>>>
:{
let parseMultiple :: Either String Int parseMultiple = do x <- parseEither '1' y <- parseEither '2' return (x + y)>>>
:}
>>>
parseMultiple
Right 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)>>>
:}
>>>
parseMultiple
Left "parse error"
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 bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Either a b -> f ( Either c d) Source # |
|
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 liftReadsPrec2 :: ( Int -> ReadS a) -> ReadS [a] -> ( Int -> ReadS b) -> ReadS [b] -> Int -> ReadS ( Either a b) Source # liftReadList2 :: ( Int -> ReadS a) -> ReadS [a] -> ( Int -> ReadS b) -> ReadS [b] -> ReadS [ Either a b] Source # liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec ( Either a b) Source # liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [ Either a b] Source # |
|
Show2 Either |
Since: base-4.9.0.0 |
Defined in Data.Functor.Classes |
|
NFData2 Either |
Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq |
|
Hashable2 Either | |
MonadError e ( Either e) | |
Defined in Control.Monad.Error.Class throwError :: e -> Either e a Source # catchError :: Either e a -> (e -> Either e a) -> Either e a Source # |
|
( 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 |
Applicative ( Either e) |
Since: base-3.0 |
Defined in Data.Either |
|
Foldable ( Either a) |
Since: base-4.7.0.0 |
Defined in Data.Foldable fold :: Monoid m => Either a m -> m Source # foldMap :: Monoid m => (a0 -> m) -> Either a a0 -> m Source # foldMap' :: Monoid m => (a0 -> m) -> Either a a0 -> m Source # foldr :: (a0 -> b -> b) -> b -> Either a a0 -> b Source # foldr' :: (a0 -> b -> b) -> b -> Either a a0 -> b Source # foldl :: (b -> a0 -> b) -> b -> Either a a0 -> b Source # foldl' :: (b -> a0 -> b) -> b -> Either a a0 -> b Source # foldr1 :: (a0 -> a0 -> a0) -> Either a a0 -> a0 Source # foldl1 :: (a0 -> a0 -> a0) -> Either a a0 -> a0 Source # toList :: Either a a0 -> [a0] Source # null :: Either a a0 -> Bool Source # length :: Either a a0 -> Int Source # elem :: Eq a0 => a0 -> Either a a0 -> Bool Source # maximum :: Ord a0 => Either a a0 -> a0 Source # minimum :: Ord a0 => Either a a0 -> a0 Source # |
|
Traversable ( Either a) |
Since: base-4.7.0.0 |
Defined in Data.Traversable traverse :: Applicative f => (a0 -> f b) -> Either a a0 -> f ( Either a b) Source # sequenceA :: Applicative f => Either a (f a0) -> f ( Either a a0) Source # mapM :: Monad m => (a0 -> m b) -> Either a a0 -> m ( Either a b) Source # sequence :: Monad m => Either a (m a0) -> m ( Either a a0) Source # |
|
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 liftReadsPrec :: ( Int -> ReadS a0) -> ReadS [a0] -> Int -> ReadS ( Either a a0) Source # liftReadList :: ( Int -> ReadS a0) -> ReadS [a0] -> ReadS [ Either a a0] Source # liftReadPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec ( Either a a0) Source # liftReadListPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec [ Either a a0] Source # |
|
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) | |
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 |
Defined in Data.Either compare :: Either a b -> Either a b -> Ordering Source # (<) :: Either a b -> Either a b -> Bool Source # (<=) :: Either a b -> Either a b -> Bool Source # (>) :: Either a b -> Either a b -> Bool Source # (>=) :: Either a b -> Either a b -> Bool Source # |
|
( 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 |
( Hashable a, Hashable b) => Hashable ( Either a b) | |
( Binary a, Binary b) => Binary ( Either a b) | |
( ToCBOR a, ToCBOR b) => ToCBOR ( Either a b) | |
( FromCBOR a, FromCBOR b) => FromCBOR ( Either a b) | |
( NFData a, NFData b) => NFData ( Either a b) | |
Defined in Control.DeepSeq |
|
( NoThunks a, NoThunks b) => NoThunks ( Either a b) | |
( Serialise a, Serialise b) => Serialise ( Either a b) |
Since: serialise-0.2.0.0 |
Recursive ( Either a b) | |
Defined in Data.Functor.Foldable 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 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 # |
|
( SemialignWithIndex i f, SemialignWithIndex j g) => SemialignWithIndex ( Either i j) ( Product f g) | |
Defined in Data.Semialign.Internal |
|
( ZipWithIndex i f, ZipWithIndex j g) => ZipWithIndex ( Either i j) ( Product f g) | |
( RepeatWithIndex i f, RepeatWithIndex j g) => RepeatWithIndex ( Either i j) ( Product f g) | |
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 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 HardForkApplyTxErr xs where Source #
pattern DegenApplyTxErr :: forall b. NoHardForks b => ApplyTxErr b -> HardForkApplyTxErr '[b] |
Instances
data HardForkBlock xs where Source #
pattern DegenBlock :: forall b. NoHardForks b => b -> HardForkBlock '[b] |
Instances
data HardForkEnvelopeErr xs where Source #
pattern DegenOtherHeaderEnvelopeError :: forall b. NoHardForks b => OtherHeaderEnvelopeError b -> HardForkEnvelopeErr '[b] |
Instances
data HardForkLedgerConfig xs where Source #
pattern DegenLedgerConfig :: PartialLedgerConfig b -> HardForkLedgerConfig '[b] |
Instances
Generic ( HardForkLedgerConfig xs) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Basics from :: HardForkLedgerConfig xs -> Rep ( HardForkLedgerConfig xs) x Source # to :: Rep ( HardForkLedgerConfig xs) x -> HardForkLedgerConfig xs Source # |
|
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.1-DT4Cvwf63DZKctsEvaJqCU" '
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 HardForkLedgerError xs where Source #
pattern DegenLedgerError :: forall b. NoHardForks b => LedgerError b -> HardForkLedgerError '[b] |
Instances
data family Header blk :: Type Source #
Instances
data family LedgerState blk :: Type Source #
Ledger state associated with a block
Instances
data OneEraTipInfo xs where Source #
pattern DegenTipInfo :: forall b. NoHardForks b => TipInfo b -> OneEraTipInfo '[b] |
Instances
CanHardFork xs => Eq ( OneEraTipInfo xs) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.AcrossEras (==) :: OneEraTipInfo xs -> OneEraTipInfo xs -> Bool Source # (/=) :: OneEraTipInfo xs -> OneEraTipInfo xs -> Bool Source # |
|
CanHardFork xs => Show ( OneEraTipInfo xs) Source # | |
CanHardFork xs => NoThunks ( OneEraTipInfo xs) Source # | |
data TopLevelConfig blk where Source #
The top-level node configuration
pattern DegenTopLevelConfig :: NoHardForks b => TopLevelConfig b -> TopLevelConfig ( HardForkBlock '[b]) |
Instances
data family TxId tx :: Type Source #
A generalized transaction,
GenTx
, identifier.