ouroboros-consensus-0.1.0.1: Consensus layer for the Ouroboros blockchain protocol
Safe Haskell Safe-Inferred
Language Haskell2010

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

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 #

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

Functor Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

MonadFix Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Applicative Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Foldable Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Traversable Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Traversable

Eq1 Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Ord1 Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Read1 Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Show1 Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

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

Semialign Identity
Instance details

Defined in Data.Semialign.Internal

Zip Identity
Instance details

Defined in Data.Semialign.Internal

Repeat Identity
Instance details

Defined in Data.Semialign.Internal

Unzip Identity
Instance details

Defined in Data.Semialign.Internal

MapHKD Identity Source #
Instance details

Defined in Ouroboros.Consensus.Util.Args

SemialignWithIndex () Identity
Instance details

Defined in Data.Semialign.Internal

ZipWithIndex () Identity
Instance details

Defined in Data.Semialign.Internal

Methods

izipWith :: (() -> a -> b -> c) -> Identity a -> Identity b -> Identity c Source #

RepeatWithIndex () Identity
Instance details

Defined in Data.Semialign.Internal

Methods

irepeat :: (() -> a) -> Identity a Source #

Unbox a => Vector Vector ( Identity a)
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox a => MVector MVector ( Identity a)
Instance details

Defined in Data.Vector.Unboxed.Base

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

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

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

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

Generic ( Identity a)

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Associated Types

type Rep ( Identity a) :: Type -> Type Source #

Semigroup a => Semigroup ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Monoid a => Monoid ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Hashable a => Hashable ( Identity a)
Instance details

Defined in Data.Hashable.Class

Storable a => Storable ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

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

NFData a => NFData ( Identity a)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Serialise a => Serialise ( Identity a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Prim a => Prim ( Identity a)

Since: primitive-0.6.5.0

Instance details

Defined in Data.Primitive.Types

Unbox a => Unbox ( Identity a)
Instance details

Defined in Data.Vector.Unboxed.Base

Generic1 Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Associated Types

type Rep1 Identity :: k -> Type Source #

newtype MVector s ( Identity a)
Instance details

Defined in Data.Vector.Unboxed.Base

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

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 ))