ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Util

Description

Miscellaneous utilities

Synopsis

Type-level utility

class Empty (a ∷ k) Source #

Instances

Instances details
Empty (a ∷ k) Source # 
Instance details

Defined in Ouroboros.Consensus.Util

class ShowProxy (p ∷ k) where #

Minimal complete definition

Nothing

Methods

showProxy ∷ Proxy p → String #

Instances

Instances details
ShowProxy SlotNo # 
Instance details

Defined in Ouroboros.Network.Util.ShowProxy

Methods

showProxy ∷ Proxy SlotNo → String #

ShowProxy Void Source # 
Instance details

Defined in Ouroboros.Consensus.Util.Orphans

Methods

showProxy ∷ Proxy Void → String #

ShowProxy NodeId Source # 
Instance details

Defined in Ouroboros.Consensus.NodeId

Methods

showProxy ∷ Proxy NodeId → String #

ShowProxy PerasRoundNo Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Types

ShowProxy PerasVoteId Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Types

ShowProxy Block # 
Instance details

Defined in Ouroboros.Network.Mock.ConcreteBlock

Methods

showProxy ∷ Proxy Block → String #

ShowProxy BlockHeader # 
Instance details

Defined in Ouroboros.Network.Mock.ConcreteBlock

Methods

showProxy ∷ Proxy BlockHeader → String #

ShowProxy KeepAlive # 
Instance details

Defined in Ouroboros.Network.Protocol.KeepAlive.Type

Methods

showProxy ∷ Proxy KeepAlive → String #

ShowProxy () Source # 
Instance details

Defined in Ouroboros.Consensus.Util.Orphans

Methods

showProxy ∷ Proxy () → String #

ShowProxy Int # 
Instance details

Defined in Ouroboros.Network.Util.ShowProxy

Methods

showProxy ∷ Proxy Int → String #

Typeable xs ⇒ ShowProxy (Header (HardForkBlock xs) ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Block

Methods

showProxy ∷ Proxy (Header (HardForkBlock xs)) → String #

Typeable xs ⇒ ShowProxy (OneEraPerasCert xs ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.AcrossEras

Methods

showProxy ∷ Proxy (OneEraPerasCert xs) → String #

Typeable xs ⇒ ShowProxy (OneEraPerasVote xs ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.AcrossEras

Methods

showProxy ∷ Proxy (OneEraPerasVote xs) → String #

Typeable xs ⇒ ShowProxy (HardForkBlock xs ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Basics

Methods

showProxy ∷ Proxy (HardForkBlock xs) → String #

Typeable xs ⇒ ShowProxy (HardForkApplyTxErr xs ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Mempool

Typeable xs ⇒ ShowProxy (GenTx (HardForkBlock xs) ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Mempool

Methods

showProxy ∷ Proxy (GenTx (HardForkBlock xs)) → String #

(Typeable m, Typeable a) ⇒ ShowProxy (GenTx (DualBlock m a) ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Methods

showProxy ∷ Proxy (GenTx (DualBlock m a)) → String #

Typeable xs ⇒ ShowProxy (TxId (GenTx (HardForkBlock xs)) ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Mempool

Methods

showProxy ∷ Proxy (TxId (GenTx (HardForkBlock xs))) → String #

(Typeable m, Typeable a) ⇒ ShowProxy (TxId (GenTx (DualBlock m a)) ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Methods

showProxy ∷ Proxy (TxId (GenTx (DualBlock m a))) → String #

ShowProxy blk ⇒ ShowProxy (MockPerasCert blk ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Cert.Mock

Methods

showProxy ∷ Proxy (MockPerasCert blk) → String #

ShowProxy blk ⇒ ShowProxy (PerasCert blk ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Cert.V1

Methods

showProxy ∷ Proxy (PerasCert blk) → String #

ShowProxy (VoidPerasCert blk ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Void

Methods

showProxy ∷ Proxy (VoidPerasCert blk) → String #

ShowProxy (VoidPerasError blk ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Void

Methods

showProxy ∷ Proxy (VoidPerasError blk) → String #

ShowProxy (VoidPerasVote blk ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Void

Methods

showProxy ∷ Proxy (VoidPerasVote blk) → String #

ShowProxy blk ⇒ ShowProxy (MockPerasVote blk ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Vote.Mock

Methods

showProxy ∷ Proxy (MockPerasVote blk) → String #

ShowProxy blk ⇒ ShowProxy (PerasVote blk ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Vote.V1

Methods

showProxy ∷ Proxy (PerasVote blk) → String #

ShowProxy blk ⇒ ShowProxy (SerialisedHeader blk ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.Serialisation

Methods

showProxy ∷ Proxy (SerialisedHeader blk) → String #

Typeable a ⇒ ShowProxy (WithBytes a ∷ Type) # 
Instance details

Defined in Ouroboros.Network.Protocol.Codec.Utils

Methods

showProxy ∷ Proxy (WithBytes a) → String #

ShowProxy (PeerSharing peer ∷ Type) # 
Instance details

Defined in Ouroboros.Network.Protocol.PeerSharing.Type

Methods

showProxy ∷ Proxy (PeerSharing peer) → String #

(Typeable m, Typeable a) ⇒ ShowProxy (DualBlock m a ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Methods

showProxy ∷ Proxy (DualBlock m a) → String #

(Typeable m, Typeable a) ⇒ ShowProxy (DualGenTxErr m a ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Methods

showProxy ∷ Proxy (DualGenTxErr m a) → String #

(Typeable m, Typeable a) ⇒ ShowProxy (DualHeader m a ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Methods

showProxy ∷ Proxy (DualHeader m a) → String #

ShowProxy block ⇒ ShowProxy (Point block ∷ Type) # 
Instance details

Defined in Ouroboros.Network.Block

Methods

showProxy ∷ Proxy (Point block) → String #

ShowProxy a ⇒ ShowProxy (Serialised a ∷ Type) # 
Instance details

Defined in Ouroboros.Network.Block

Methods

showProxy ∷ Proxy (Serialised a) → String #

ShowProxy b ⇒ ShowProxy (Tip b ∷ Type) # 
Instance details

Defined in Ouroboros.Network.Block

Methods

showProxy ∷ Proxy (Tip b) → String #

ShowProxy block ⇒ ShowProxy (BlockFetch block point ∷ Type) # 
Instance details

Defined in Ouroboros.Network.Protocol.BlockFetch.Type

Methods

showProxy ∷ Proxy (BlockFetch block point) → String #

(ShowProxy tx, ShowProxy reject) ⇒ ShowProxy (LocalTxSubmission tx reject ∷ Type) # 
Instance details

Defined in Ouroboros.Network.Protocol.LocalTxSubmission.Type

Methods

showProxy ∷ Proxy (LocalTxSubmission tx reject) → String #

(ShowProxy objectId, ShowProxy object) ⇒ ShowProxy (ObjectDiffusion objectId object ∷ Type) # 
Instance details

Defined in Ouroboros.Network.Protocol.ObjectDiffusion.Type

Methods

showProxy ∷ Proxy (ObjectDiffusion objectId object) → String #

(ShowProxy txid, ShowProxy tx) ⇒ ShowProxy (TxSubmission2 txid tx ∷ Type) # 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Methods

showProxy ∷ Proxy (TxSubmission2 txid tx) → String #

(ShowProxy header, ShowProxy tip) ⇒ ShowProxy (ChainSync header point tip ∷ Type) # 
Instance details

Defined in Ouroboros.Network.Protocol.ChainSync.Type

Methods

showProxy ∷ Proxy (ChainSync header point tip) → String #

(ShowProxy block, ShowProxy query) ⇒ ShowProxy (LocalStateQuery block point query ∷ Type) # 
Instance details

Defined in Ouroboros.Network.Protocol.LocalStateQuery.Type

Methods

showProxy ∷ Proxy (LocalStateQuery block point query) → String #

(ShowProxy txid, ShowProxy tx, ShowProxy slot) ⇒ ShowProxy (LocalTxMonitor txid tx slot ∷ Type) # 
Instance details

Defined in Ouroboros.Network.Protocol.LocalTxMonitor.Type

Methods

showProxy ∷ Proxy (LocalTxMonitor txid tx slot) → String #

Typeable xs ⇒ ShowProxy (BlockQuery (HardForkBlock xs) ∷ QueryFootprint → Type → Type) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger.Query

(Typeable m, Typeable a) ⇒ ShowProxy (BlockQuery (DualBlock m a) ∷ QueryFootprint → Type → Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Methods

showProxy ∷ Proxy (BlockQuery (DualBlock m a)) → String #

ShowProxy (BlockQuery blk) ⇒ ShowProxy (Query blk ∷ Type → Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query

Methods

showProxy ∷ Proxy (Query blk) → String #

ShowProxy ('StIdle ∷ ObjectDiffusion objectId object) # 
Instance details

Defined in Ouroboros.Network.Protocol.ObjectDiffusion.Type

Methods

showProxy ∷ Proxy ('StIdle ∷ ObjectDiffusion objectId object) → String #

ShowProxy ('StIdle ∷ TxSubmission2 txid tx) # 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Methods

showProxy ∷ Proxy ('StIdle ∷ TxSubmission2 txid tx) → String #

data Some (f ∷ k → Type) where #

Constructors

Some ∷ ∀ {k} (f ∷ k → Type) (a ∷ k). f a → Some f 

data SomePair (f ∷ k → Type) (g ∷ k → Type) where Source #

Pair of functors instantiated to the same existential

Constructors

SomePair ∷ ∀ {k} (f ∷ k → Type) (a ∷ k) (g ∷ k → Type). f a → g a → SomePair f g 

data SomeSecond (f ∷ k1 → k2 → Type) (a ∷ k1) where Source #

Hide the second type argument of some functor

SomeSecond f a is isomorphic to Some (f a), but is more convenient in partial applications.

Constructors

SomeSecond ∷ ∀ {k1} {k2} (f ∷ k1 → k2 → Type) (a ∷ k1) (b ∷ k2). !(f a b) → SomeSecond f a 

Instances

Instances details
Isomorphic (SomeSecond (NestedCtxt f)) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Embed.Unary

SameDepIndex (NestedCtxt_ blk f) ⇒ Eq (SomeSecond (NestedCtxt f) blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.NestedContent

Methods

(==) ∷ SomeSecond (NestedCtxt f) blk → SomeSecond (NestedCtxt f) blk → Bool #

(/=) ∷ SomeSecond (NestedCtxt f) blk → SomeSecond (NestedCtxt f) blk → Bool #

SameDepIndex (Query blk) ⇒ Eq (SomeSecond Query blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query

Methods

(==) ∷ SomeSecond Query blk → SomeSecond Query blk → Bool #

(/=) ∷ SomeSecond Query blk → SomeSecond Query blk → Bool #

HasNestedContent f blk ⇒ Show (SomeSecond (NestedCtxt f) blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.NestedContent

Methods

showsPrec ∷ Int → SomeSecond (NestedCtxt f) blk → ShowS #

show ∷ SomeSecond (NestedCtxt f) blk → String #

showList ∷ [SomeSecond (NestedCtxt f) blk] → ShowS #

Show (SomeBlockQuery (BlockQuery blk)) ⇒ Show (SomeSecond Query blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Query

Methods

showsPrec ∷ Int → SomeSecond Query blk → ShowS #

show ∷ SomeSecond Query blk → String #

showList ∷ [SomeSecond Query blk] → ShowS #

(Typeable f, Typeable blk) ⇒ NoThunks (SomeSecond (NestedCtxt f) blk) Source #

We can write a manual instance using the following quantified constraint:

forall a. NoThunks (f blk a)

However, this constraint would have to be propagated all the way up, which is rather verbose and annoying (standalone deriving has to be used), hence we use InspectHeap for convenience.

Instance details

Defined in Ouroboros.Consensus.Block.NestedContent

Folding variations

foldlM' ∷ ∀ m a b. Monad m ⇒ (b → a → m b) → b → [a] → m b Source #

nTimes ∷ (a → a) → Word64 → a → a Source #

Apply a function n times. The value of each application is forced.

nTimesM ∷ Monad m ⇒ (a → m a) → Word64 → a → m a Source #

Apply a function n times through a monadic bind. The value of each application is forced.

repeatedly ∷ (a → b → b) → [a] → b → b Source #

repeatedlyM ∷ Monad m ⇒ (a → b → m b) → [a] → b → m b Source #

Lists

allEqual ∷ Eq a ⇒ [a] → Bool Source #

chunks ∷ Int → [a] → [[a]] Source #

dropLast ∷ Word64 → [a] → [a] Source #

Drop the last n elements

findM ∷ (Foldable f, Monad m) ⇒ (a → m Bool) → f a → m (Maybe a) Source #

firstJust ∷ ∀ a b f. Foldable f ⇒ (a → Maybe b) → f a → Maybe b Source #

markLast ∷ [a] → [Either a a] Source #

Mark the last element of the list as Right

pickOne ∷ [a] → [([a], a, [a])] Source #

All possible ways to pick on element from a list, preserving order

pickOne [1,2,3] = [ ([], 1, [2, 3])
                  , ([1], 2, [3])
                  , ([1,2], 3, [])
                  ]

split ∷ (a → Bool) → [a] → NonEmpty [a] Source #

Split a list given a delimiter predicate.

>>> split (`elem` "xy") "axbyxc"
"a" :| ["b","","c"]

We have the laws

concat (split p as) === filter (not . p) as
length (split p as) === length (filter p as) + 1

splits ∷ [a] → [([a], a, [a])] Source #

Focus on one element in the list

E.g.

   splits [1..3]
== [ ([]    , 1 , [2,3])
   , ([1]   , 2 , [3]  )
   , ([1,2] , 3 , []   )
   ]

takeLast ∷ Word64 → [a] → [a] Source #

Take the last n elements

takeUntil ∷ (a → Bool) → [a] → [a] Source #

Take items until the condition is true. If the condition is true for an item, include that item as the last item in the returned list. If the condition was never true, the original list is returned.

takeUntil (== 3) [1,2,3,4]
1,2,3
> takeUntil (== 2) [0,1,0]
0,1,0
> takeUntil (== 2) [2,2,3]
2

Safe variants of existing base functions

lastMaybe ∷ [a] → Maybe a Source #

safeMaximum ∷ Ord a ⇒ [a] → Maybe a Source #

safeMaximumBy ∷ (a → a → Ordering) → [a] → Maybe a Source #

safeMaximumOn ∷ Ord b ⇒ (a → b) → [a] → Maybe a Source #

Hashes

hashFromBytesE ∷ (HashAlgorithm h, HasCallStack) ⇒ ByteString → Hash h a Source #

Calls hashFromBytes and throws an error if the input is of the wrong length.

hashFromBytesShortE ∷ (HashAlgorithm h, HasCallStack) ⇒ ShortByteString → Hash h a Source #

Calls hashFromBytesShort and throws an error if the input is of the wrong length.

Bytestrings

Monadic utilities

whenJust ∷ Applicative f ⇒ Maybe a → (a → f ()) → f () Source #

whenNothing ∷ Applicative f ⇒ Maybe a → f () → f () Source #

Test code

checkThat ∷ (Show a, Monad m) ⇒ String → (a → Bool) → a → m () Source #

Assertion

Variation on assert for use in testing code.

Sets

allDisjoint ∷ Ord a ⇒ [Set a] → Bool Source #

Check that a bunch of sets are all mutually disjoint

Composition

(......:) ∷ (y → z) → (x0 → x1 → x2 → x3 → x4 → x5 → x6 → y) → x0 → x1 → x2 → x3 → x4 → x5 → x6 → z Source #

(.....:) ∷ (y → z) → (x0 → x1 → x2 → x3 → x4 → x5 → y) → x0 → x1 → x2 → x3 → x4 → x5 → z Source #

(....:) ∷ (y → z) → (x0 → x1 → x2 → x3 → x4 → y) → x0 → x1 → x2 → x3 → x4 → z Source #

(...:) ∷ (y → z) → (x0 → x1 → x2 → x3 → y) → x0 → x1 → x2 → x3 → z Source #

(..:) ∷ (y → z) → (x0 → x1 → x2 → y) → x0 → x1 → x2 → z Source #

(.:) ∷ (y → z) → (x0 → x1 → y) → x0 → x1 → z Source #

Product

pairFst ∷ ∀ {k} f (g ∷ k → Type) (a ∷ k). Product f g a → f a Source #

pairSnd ∷ ∀ {k} (f ∷ k → Type) g (a ∷ k). Product f g a → g a Source #

Miscellaneous

fib ∷ Word64 → Word64 Source #

Fast Fibonacci computation, using Binet's formula

Electric code

data Electric (m ∷ k → Type) (a ∷ k) Source #

An action that cannot be ran without drawing current through a Fuse.

NOTE: using Fuse m -> ... would suffice but the newtype wrapper is useful for ensuring we don't make mistakes.

Instances

Instances details
MonadTrans (Electric ∷ (Type → Type) → Type → Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Util

Methods

lift ∷ Monad m ⇒ m a → Electric m a #

Applicative m ⇒ Applicative (Electric m) Source # 
Instance details

Defined in Ouroboros.Consensus.Util

Methods

pure ∷ a → Electric m a #

(<*>) ∷ Electric m (a → b) → Electric m a → Electric m b #

liftA2 ∷ (a → b → c) → Electric m a → Electric m b → Electric m c #

(*>) ∷ Electric m a → Electric m b → Electric m b #

(<*) ∷ Electric m a → Electric m b → Electric m a #

Functor m ⇒ Functor (Electric m) Source # 
Instance details

Defined in Ouroboros.Consensus.Util

Methods

fmap ∷ (a → b) → Electric m a → Electric m b #

(<$) ∷ a → Electric m b → Electric m a #

Monad m ⇒ Monad (Electric m) Source # 
Instance details

Defined in Ouroboros.Consensus.Util

Methods

(>>=) ∷ Electric m a → (a → Electric m b) → Electric m b #

(>>) ∷ Electric m a → Electric m b → Electric m b #

return ∷ a → Electric m a #

MonadCatch m ⇒ MonadCatch (Electric m) Source # 
Instance details

Defined in Ouroboros.Consensus.Util

Methods

catch ∷ Exception e ⇒ Electric m a → (e → Electric m a) → Electric m a Source #

catchJust ∷ Exception e ⇒ (e → Maybe b) → Electric m a → (b → Electric m a) → Electric m a Source #

try ∷ Exception e ⇒ Electric m a → Electric m (Either e a) Source #

tryJust ∷ Exception e ⇒ (e → Maybe b) → Electric m a → Electric m (Either b a) Source #

handle ∷ Exception e ⇒ (e → Electric m a) → Electric m a → Electric m a Source #

handleJust ∷ Exception e ⇒ (e → Maybe b) → (b → Electric m a) → Electric m a → Electric m a Source #

onException ∷ Electric m a → Electric m b → Electric m a Source #

bracketOnError ∷ Electric m a → (a → Electric m b) → (a → Electric m c) → Electric m c Source #

generalBracket ∷ Electric m a → (a → ExitCase b → Electric m c) → (a → Electric m b) → Electric m (b, c) Source #

MonadThrow m ⇒ MonadThrow (Electric m) Source # 
Instance details

Defined in Ouroboros.Consensus.Util

Methods

throwIO ∷ Exception e ⇒ e → Electric m a Source #

bracket ∷ Electric m a → (a → Electric m b) → (a → Electric m c) → Electric m c Source #

bracket_ ∷ Electric m a → Electric m b → Electric m c → Electric m c Source #

finally ∷ Electric m a → Electric m b → Electric m a Source #

annotateIO ∷ ExceptionAnnotation e ⇒ e → Electric m a → Electric m a Source #

data Fuse (m ∷ Type → Type) Source #

A simple semaphore, though instead of blocking a fatal exception is thrown.

Instances

Instances details
Generic (Fuse m) Source # 
Instance details

Defined in Ouroboros.Consensus.Util

Associated Types

type Rep (Fuse m) 
Instance details

Defined in Ouroboros.Consensus.Util

type Rep (Fuse m) = D1 ('MetaData "Fuse" "Ouroboros.Consensus.Util" "ouroboros-consensus-4.0.0.0-inplace" 'False) (C1 ('MetaCons "Fuse" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictMVar m ()))))

Methods

from ∷ Fuse m → Rep (Fuse m) x #

to ∷ Rep (Fuse m) x → Fuse m #

NoThunks (StrictMVar m ()) ⇒ NoThunks (Fuse m) Source # 
Instance details

Defined in Ouroboros.Consensus.Util

type Rep (Fuse m) Source # 
Instance details

Defined in Ouroboros.Consensus.Util

type Rep (Fuse m) = D1 ('MetaData "Fuse" "Ouroboros.Consensus.Util" "ouroboros-consensus-4.0.0.0-inplace" 'False) (C1 ('MetaCons "Fuse" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictMVar m ()))))

electric ∷ ∀ {k} m (a ∷ k). m a → Electric m a Source #

newFuse ∷ MonadMVar m ⇒ Text → m (Fuse m) Source #

withFuse ∷ (MonadThrow m, MonadMVar m) ⇒ Fuse m → Electric m a → m a Source #

Put full load on the Fuse while the Electric is running.

Thus any two withFuse calls with the same Fuse will throw one fatal exception.

NOTE The metaphor is: when I run at most one waffle iron concurrently, my kitchen's fuse doesn't blow. But it blows if I run more than one waffle iron concurrently.

WARNING If the given action throws its own exception, then it will never stop putting load on the Fuse.

Type-safe boolean flags

newtype Flag (name ∷ Symbol) Source #

Type-safe boolean flags with type level tags

It is recommended to create pattern synonyms for the true and false values.

See DiskSnapshotChecksum for an example.

Constructors

Flag 

Fields

Instances

Instances details
Eq (Flag name) Source # 
Instance details

Defined in Ouroboros.Consensus.Util

Methods

(==) ∷ Flag name → Flag name → Bool #

(/=) ∷ Flag name → Flag name → Bool #

Generic (Flag name) Source # 
Instance details

Defined in Ouroboros.Consensus.Util

Associated Types

type Rep (Flag name) 
Instance details

Defined in Ouroboros.Consensus.Util

type Rep (Flag name) = D1 ('MetaData "Flag" "Ouroboros.Consensus.Util" "ouroboros-consensus-4.0.0.0-inplace" 'True) (C1 ('MetaCons "Flag" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFlag") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))

Methods

from ∷ Flag name → Rep (Flag name) x #

to ∷ Rep (Flag name) x → Flag name #

Show (Flag name) Source # 
Instance details

Defined in Ouroboros.Consensus.Util

Methods

showsPrec ∷ Int → Flag name → ShowS #

show ∷ Flag name → String #

showList ∷ [Flag name] → ShowS #

type Rep (Flag name) Source # 
Instance details

Defined in Ouroboros.Consensus.Util

type Rep (Flag name) = D1 ('MetaData "Flag" "Ouroboros.Consensus.Util" "ouroboros-consensus-4.0.0.0-inplace" 'True) (C1 ('MetaCons "Flag" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFlag") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))

Unsafe coercions or maps

coerceMapKeys ∷ Coercible k1 k2 ⇒ Map k1 v → Map k2 v Source #

Warning: This function expects the types of the keys to have exactly the same Ord ordering.If you are certain this is the case, ignore this warning with `-Wno-x-ord-preserving-coercions`.

coerceSet ∷ Coercible k1 k2 ⇒ Set k1 → Set k2 Source #

Warning: This function expects the types of the keys to have exactly the same Ord ordering.If you are certain this is the case, ignore this warning with `-Wno-x-ord-preserving-coercions`.