ouroboros-consensus-0.1.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Consensus.Util.Args

Description

Utilities for arguments record with defaults

Useful for when you want to define a default value of an arguments record consisting of a mix of arguments with/without defaults.

The following code example explains it best:

data Args f = Args {
      hasNoDefault :: HKD f Int
    , hasDefault   :: Bool
    }

defaultArgs :: Args Defaults
defaultArgs = Args {
      hasNoDefault = NoDefault
    , hasDefault   = False
    }

theArgs :: Args Identity
theArgs = defaultArgs {
      hasNoDefault = 0
    }

useArgs :: Args Identity -> (Int, Bool)
useArgs (Args a b) = (a, b)

Leaving out the hasNoDefault field from theArgs will result in a type error.

Synopsis

Documentation

data Defaults t Source #

Constructors

NoDefault 

Instances

Instances details
Functor Defaults Source # 
Instance details

Defined in Ouroboros.Consensus.Util.Args

Methods

fmap ∷ (a → b) → Defaults a → Defaults b Source #

(<$) ∷ a → Defaults b → Defaults a Source #

MapHKD Defaults Source # 
Instance details

Defined in Ouroboros.Consensus.Util.Args

Methods

mapHKD ∷ proxy (Defaults b) → (a → b) → HKD Defaults a → HKD Defaults b Source #

type family HKD f a where ... Source #

Equations

HKD Identity a = a 
HKD f a = f a 

class MapHKD f where Source #

Methods

mapHKD ∷ proxy (f b) → (a → b) → HKD f a → HKD f b Source #

Instances

Instances details
MapHKD Identity Source # 
Instance details

Defined in Ouroboros.Consensus.Util.Args

Methods

mapHKD ∷ proxy (Identity b) → (a → b) → HKD Identity a → HKD Identity b Source #

MapHKD Defaults Source # 
Instance details

Defined in Ouroboros.Consensus.Util.Args

Methods

mapHKD ∷ proxy (Defaults b) → (a → b) → HKD Defaults a → HKD Defaults b Source #

Re-exported for convenience

newtype Identity a Source #

Identity functor and monad. (a non-strict monad)

Since: base-4.8.0.0

Constructors

Identity 

Fields

Instances

Instances details
Monad Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

(>>=)Identity a → (a → Identity b) → Identity b Source #

(>>)Identity a → Identity b → Identity b Source #

return ∷ a → Identity a Source #

Functor Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

fmap ∷ (a → b) → Identity a → Identity b Source #

(<$) ∷ a → Identity b → Identity a Source #

MonadFix Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

mfix ∷ (a → Identity a) → Identity a Source #

Applicative Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

pure ∷ a → Identity a Source #

(<*>)Identity (a → b) → Identity a → Identity b Source #

liftA2 ∷ (a → b → c) → Identity a → Identity b → Identity c Source #

(*>)Identity a → Identity b → Identity b Source #

(<*)Identity a → Identity b → Identity a Source #

Foldable Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

foldMonoid m ⇒ Identity m → m Source #

foldMapMonoid m ⇒ (a → m) → Identity a → m Source #

foldMap'Monoid m ⇒ (a → m) → Identity a → m Source #

foldr ∷ (a → b → b) → b → Identity a → b Source #

foldr' ∷ (a → b → b) → b → Identity a → b Source #

foldl ∷ (b → a → b) → b → Identity a → b Source #

foldl' ∷ (b → a → b) → b → Identity a → b Source #

foldr1 ∷ (a → a → a) → Identity a → a Source #

foldl1 ∷ (a → a → a) → Identity a → a Source #

toListIdentity a → [a] Source #

nullIdentity a → Bool Source #

lengthIdentity a → Int Source #

elemEq a ⇒ a → Identity a → Bool Source #

maximumOrd a ⇒ Identity a → a Source #

minimumOrd a ⇒ Identity a → a Source #

sumNum a ⇒ Identity a → a Source #

productNum a ⇒ Identity a → a Source #

Traversable Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Traversable

Methods

traverseApplicative f ⇒ (a → f b) → Identity a → f (Identity b) Source #

sequenceAApplicative f ⇒ Identity (f a) → f (Identity a) Source #

mapMMonad m ⇒ (a → m b) → Identity a → m (Identity b) Source #

sequenceMonad m ⇒ Identity (m a) → m (Identity a) Source #

Eq1 Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq ∷ (a → b → Bool) → Identity a → Identity b → Bool Source #

Ord1 Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare ∷ (a → b → Ordering) → Identity a → Identity b → Ordering Source #

Read1 Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftReadsPrec ∷ (IntReadS a) → ReadS [a] → IntReadS (Identity a) Source #

liftReadList ∷ (IntReadS a) → ReadS [a] → ReadS [Identity a] Source #

liftReadPrecReadPrec a → ReadPrec [a] → ReadPrec (Identity a) Source #

liftReadListPrecReadPrec a → ReadPrec [a] → ReadPrec [Identity a] Source #

Show1 Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec ∷ (Int → a → ShowS) → ([a] → ShowS) → IntIdentity a → ShowS Source #

liftShowList ∷ (Int → a → ShowS) → ([a] → ShowS) → [Identity a] → ShowS Source #

NFData1 Identity

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf ∷ (a → ()) → Identity a → () Source #

Hashable1 Identity 
Instance details

Defined in Data.Hashable.Class

Methods

liftHashWithSalt ∷ (Int → a → Int) → IntIdentity a → Int

Semialign Identity 
Instance details

Defined in Data.Semialign.Internal

Methods

alignIdentity a → Identity b → Identity (These a b)

alignWith ∷ (These a b → c) → Identity a → Identity b → Identity c

Zip Identity 
Instance details

Defined in Data.Semialign.Internal

Methods

zipIdentity a → Identity b → Identity (a, b)

zipWith ∷ (a → b → c) → Identity a → Identity b → Identity c

MapHKD Identity Source # 
Instance details

Defined in Ouroboros.Consensus.Util.Args

Methods

mapHKD ∷ proxy (Identity b) → (a → b) → HKD Identity a → HKD Identity b Source #

Repeat Identity 
Instance details

Defined in Data.Semialign.Internal

Methods

repeat ∷ a → Identity a

Unzip Identity 
Instance details

Defined in Data.Semialign.Internal

Methods

unzipWith ∷ (c → (a, b)) → Identity c → (Identity a, Identity b)

unzipIdentity (a, b) → (Identity a, Identity b)

SemialignWithIndex () Identity 
Instance details

Defined in Data.Semialign.Internal

Methods

ialignWith ∷ (() → These a b → c) → Identity a → Identity b → Identity c

ZipWithIndex () Identity 
Instance details

Defined in Data.Semialign.Internal

Methods

izipWith ∷ (() → a → b → c) → Identity a → Identity b → Identity c

RepeatWithIndex () Identity 
Instance details

Defined in Data.Semialign.Internal

Methods

irepeat ∷ (() → a) → Identity a

Unbox a ⇒ Vector Vector (Identity a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicUnsafeFreeze ∷ PrimMonad m ⇒ Mutable Vector (PrimState m) (Identity a) → m (Vector (Identity a))

basicUnsafeThaw ∷ PrimMonad m ⇒ Vector (Identity a) → m (Mutable Vector (PrimState m) (Identity a))

basicLength ∷ Vector (Identity a) → Int

basicUnsafeSliceIntInt → Vector (Identity a) → Vector (Identity a)

basicUnsafeIndexMMonad m ⇒ Vector (Identity a) → Int → m (Identity a)

basicUnsafeCopy ∷ PrimMonad m ⇒ Mutable Vector (PrimState m) (Identity a) → Vector (Identity a) → m ()

elemseq ∷ Vector (Identity a) → Identity a → b → b

Unbox a ⇒ MVector MVector (Identity a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicLength ∷ MVector s (Identity a) → Int

basicUnsafeSliceIntInt → MVector s (Identity a) → MVector s (Identity a)

basicOverlaps ∷ MVector s (Identity a) → MVector s (Identity a) → Bool

basicUnsafeNew ∷ PrimMonad m ⇒ Int → m (MVector (PrimState m) (Identity a))

basicInitialize ∷ PrimMonad m ⇒ MVector (PrimState m) (Identity a) → m ()

basicUnsafeReplicate ∷ PrimMonad m ⇒ IntIdentity a → m (MVector (PrimState m) (Identity a))

basicUnsafeRead ∷ PrimMonad m ⇒ MVector (PrimState m) (Identity a) → Int → m (Identity a)

basicUnsafeWrite ∷ PrimMonad m ⇒ MVector (PrimState m) (Identity a) → IntIdentity a → m ()

basicClear ∷ PrimMonad m ⇒ MVector (PrimState m) (Identity a) → m ()

basicSet ∷ PrimMonad m ⇒ MVector (PrimState m) (Identity a) → Identity a → m ()

basicUnsafeCopy ∷ PrimMonad m ⇒ MVector (PrimState m) (Identity a) → MVector (PrimState m) (Identity a) → m ()

basicUnsafeMove ∷ PrimMonad m ⇒ MVector (PrimState m) (Identity a) → MVector (PrimState m) (Identity a) → m ()

basicUnsafeGrow ∷ PrimMonad m ⇒ MVector (PrimState m) (Identity a) → Int → m (MVector (PrimState m) (Identity a))

Bounded a ⇒ Bounded (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Enum a ⇒ Enum (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Eq a ⇒ Eq (Identity a)

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

(==)Identity a → Identity a → Bool Source #

(/=)Identity a → Identity a → Bool Source #

Floating a ⇒ Floating (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Fractional a ⇒ Fractional (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Integral a ⇒ Integral (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Num a ⇒ Num (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Ord a ⇒ Ord (Identity a)

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

compareIdentity a → Identity a → Ordering Source #

(<)Identity a → Identity a → Bool Source #

(<=)Identity a → Identity a → Bool Source #

(>)Identity a → Identity a → Bool Source #

(>=)Identity a → Identity a → Bool Source #

maxIdentity a → Identity a → Identity a Source #

minIdentity a → Identity a → Identity a Source #

Read a ⇒ Read (Identity a)

This instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removed

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Real a ⇒ Real (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

RealFloat a ⇒ RealFloat (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

RealFrac a ⇒ RealFrac (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

properFractionIntegral b ⇒ Identity a → (b, Identity a) Source #

truncateIntegral b ⇒ Identity a → b Source #

roundIntegral b ⇒ Identity a → b Source #

ceilingIntegral b ⇒ Identity a → b Source #

floorIntegral b ⇒ Identity a → b Source #

Show a ⇒ Show (Identity a)

This instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removed

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Ix a ⇒ Ix (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

IsString a ⇒ IsString (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.String

Methods

fromStringStringIdentity a Source #

Generic (Identity a)

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Associated Types

type Rep (Identity a) ∷ TypeType Source #

Methods

fromIdentity a → Rep (Identity a) x Source #

toRep (Identity a) x → Identity a Source #

Semigroup a ⇒ Semigroup (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

(<>)Identity a → Identity a → Identity a Source #

sconcatNonEmpty (Identity a) → Identity a Source #

stimesIntegral b ⇒ b → Identity a → Identity a Source #

Monoid a ⇒ Monoid (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Storable a ⇒ Storable (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

sizeOfIdentity a → Int Source #

alignmentIdentity a → Int Source #

peekElemOffPtr (Identity a) → IntIO (Identity a) Source #

pokeElemOffPtr (Identity a) → IntIdentity a → IO () Source #

peekByteOffPtr b → IntIO (Identity a) Source #

pokeByteOffPtr b → IntIdentity a → IO () Source #

peekPtr (Identity a) → IO (Identity a) Source #

pokePtr (Identity a) → Identity a → IO () Source #

Bits a ⇒ Bits (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

FiniteBits a ⇒ FiniteBits (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Binary a ⇒ Binary (Identity a) 
Instance details

Defined in Data.Binary.Class

Methods

putIdentity a → Put Source #

getGet (Identity a) Source #

putList ∷ [Identity a] → Put Source #

NFData a ⇒ NFData (Identity a)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnfIdentity a → () Source #

Hashable a ⇒ Hashable (Identity a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSaltIntIdentity a → Int

hashIdentity a → Int

Serialise a ⇒ Serialise (Identity a) 
Instance details

Defined in Codec.Serialise.Class

Methods

encodeIdentity a → Encoding #

decode ∷ Decoder s (Identity a) #

encodeList ∷ [Identity a] → Encoding #

decodeList ∷ Decoder s [Identity a] #

Unbox a ⇒ Unbox (Identity a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Prim a ⇒ Prim (Identity a) 
Instance details

Defined in Data.Primitive.Types

Methods

sizeOf#Identity a → Int#

alignment#Identity a → Int#

indexByteArray#ByteArray#Int#Identity a

readByteArray#MutableByteArray# s → Int#State# s → (# State# s, Identity a #)

writeByteArray#MutableByteArray# s → Int#Identity a → State# s → State# s

setByteArray#MutableByteArray# s → Int#Int#Identity a → State# s → State# s

indexOffAddr#Addr#Int#Identity a

readOffAddr#Addr#Int#State# s → (# State# s, Identity a #)

writeOffAddr#Addr#Int#Identity a → State# s → State# s

setOffAddr#Addr#Int#Int#Identity a → State# s → State# s

Generic1 Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Associated Types

type Rep1 Identity ∷ k → Type Source #

Methods

from1 ∷ ∀ (a ∷ k). Identity a → Rep1 Identity a Source #

to1 ∷ ∀ (a ∷ k). Rep1 Identity a → Identity a Source #

newtype MVector s (Identity a) 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s (Identity a) = MV_Identity (MVector s a)
type Rep (Identity a) 
Instance details

Defined in Data.Functor.Identity

type Rep (Identity a) = D1 ('MetaData "Identity" "Data.Functor.Identity" "base" 'True) (C1 ('MetaCons "Identity" 'PrefixI 'True) (S1 ('MetaSel ('Just "runIdentity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
newtype Vector (Identity a) 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype Vector (Identity a) = V_Identity (Vector a)
type Rep1 Identity 
Instance details

Defined in Data.Functor.Identity

type Rep1 Identity = D1 ('MetaData "Identity" "Data.Functor.Identity" "base" 'True) (C1 ('MetaCons "Identity" 'PrefixI 'True) (S1 ('MetaSel ('Just "runIdentity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))