ouroboros-consensus
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Consensus.Util.HList

Description

Heterogeneous lists

Intended for qualified import

Synopsis

Basic definitions

type family All (c ∷ Type → Constraint) (as ∷ [Type]) where ... Source #

Equations

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

data HList (a ∷ [Type]) where Source #

Constructors

Nil ∷ HList ('[] ∷ [Type]) 
(:*) ∷ ∀ a1 (as ∷ [Type]). a1 → HList as → HList (a1 ': as) infixr 9 

Instances

Instances details
(IsList as, All Eq as) ⇒ Eq (HList as) Source # 
Instance details

Defined in Ouroboros.Consensus.Util.HList

Methods

(==) ∷ HList as → HList as → Bool #

(/=) ∷ HList as → HList as → Bool #

(IsList as, All Eq as, All Ord as) ⇒ Ord (HList as) Source # 
Instance details

Defined in Ouroboros.Consensus.Util.HList

Methods

compare ∷ HList as → HList as → Ordering #

(<) ∷ HList as → HList as → Bool #

(<=) ∷ HList as → HList as → Bool #

(>) ∷ HList as → HList as → Bool #

(>=) ∷ HList as → HList as → Bool #

max ∷ HList as → HList as → HList as #

min ∷ HList as → HList as → HList as #

All Show as ⇒ Show (HList as) Source # 
Instance details

Defined in Ouroboros.Consensus.Util.HList

Methods

showsPrec ∷ Int → HList as → ShowS #

show ∷ HList as → String #

showList ∷ [HList as] → ShowS #

All Condense as ⇒ Condense (HList as) Source # 
Instance details

Defined in Ouroboros.Consensus.Util.Condense

Methods

condense ∷ HList as → String Source #

Folding

collapse ∷ ∀ c (as ∷ [Type]) b proxy. All c as ⇒ proxy c → (∀ a. c a ⇒ a → b) → HList as → [b] Source #

foldMap ∷ ∀ c (as ∷ [Type]) b proxy. (All c as, Monoid b) ⇒ proxy c → (∀ a. c a ⇒ a → b) → HList as → b Source #

foldl ∷ ∀ c (as ∷ [Type]) b proxy. All c as ⇒ proxy c → (∀ a. c a ⇒ b → a → b) → b → HList as → b Source #

foldlM ∷ ∀ c (as ∷ [Type]) m b proxy. (All c as, Monad m) ⇒ proxy c → (∀ a. c a ⇒ b → a → m b) → b → HList as → m b Source #

foldr ∷ ∀ c (as ∷ [Type]) b proxy. All c as ⇒ proxy c → (∀ a. c a ⇒ a → b → b) → b → HList as → b Source #

repeatedly ∷ ∀ c (as ∷ [Type]) b proxy. All c as ⇒ proxy c → (∀ 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 ∷ ∀ c (as ∷ [Type]) b proxy m. (Monad m, All c as) ⇒ proxy c → (∀ a. c a ⇒ a → b → m b) → HList as → b → m b Source #

Singletons

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

Methods

isList ∷ SList xs Source #

Instances

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

Defined in Ouroboros.Consensus.Util.HList

Methods

isList ∷ SList ('[] ∷ [Type]) Source #

IsList as ⇒ IsList (a ': as) Source # 
Instance details

Defined in Ouroboros.Consensus.Util.HList

Methods

isList ∷ SList (a ': as) Source #

data SList (a ∷ [Type]) Source #

n-ary functions

type family Fn (as ∷ [Type]) b where ... Source #

Equations

Fn ('[] ∷ [Type]) b = b 
Fn (a ': as) b = a → Fn as b 

afterFn ∷ ∀ (as ∷ [Type]) b c. SList as → (b → c) → Fn as b → Fn as c Source #

applyFn ∷ ∀ (as ∷ [Type]) b. Fn as b → HList as → b Source #