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

Ouroboros.Consensus.Util.HList

Description

Heterogeneous lists

Intended for qualified import

Synopsis

Basic definitions

type family All c as :: Constraint where ... Source #

Equations

All c '[] = ()
All c (a ': as) = (c a, All c as)

Folding

collapse :: forall c as b proxy. All c as => proxy c -> ( forall a. c a => a -> b) -> HList as -> [b] Source #

foldMap :: forall c as b proxy. ( All c as, Monoid b) => proxy c -> ( forall a. c a => a -> b) -> HList as -> b Source #

foldl :: forall c as b proxy. All c as => proxy c -> ( forall a. c a => b -> a -> b) -> b -> HList as -> b Source #

foldlM :: forall c as m b proxy. ( All c as, Monad m) => proxy c -> ( forall a. c a => b -> a -> m b) -> b -> HList as -> m b Source #

foldr :: forall c as b proxy. All c as => proxy c -> ( forall a. c a => a -> b -> b) -> b -> HList as -> b Source #

repeatedly :: forall c as b proxy. All c as => proxy c -> ( forall a. c a => a -> b -> b) -> HList as -> b -> b Source #

Apply function repeatedly for all elements of the list

repeatedly p = flip . foldl p . flip

repeatedlyM :: forall c as b proxy m. ( Monad m, All c as) => proxy c -> ( forall a. c a => a -> b -> m b) -> HList as -> b -> m b Source #

Singletons

class IsList (xs :: [ Type ]) where Source #

Instances

Instances details
IsList ('[] :: [ Type ]) Source #
Instance details

Defined in Ouroboros.Consensus.Util.HList

IsList as => IsList (a ': as) Source #
Instance details

Defined in Ouroboros.Consensus.Util.HList

Methods

isList :: SList (a ': as) Source #

n-ary functions

type family Fn as b where ... Source #

Equations

Fn '[] b = b
Fn (a ': as) b = a -> Fn as b

afterFn :: SList as -> (b -> c) -> Fn as b -> Fn as c Source #