| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Util.Args
Contents
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.
Documentation
Re-exported for convenience
Identity functor and monad. (a non-strict monad)
Since: base-4.8.0.0
Constructors
| Identity | |
Fields
| |