Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Frames.TypeLevel
Description
Helpers for working with type-level lists.
Synopsis
- type family AllAre (a :: k) (ts :: [k]) where ...
- type family ReplaceAll (a2 :: a) (xs :: [a1]) :: [a] where ...
- type family ReplaceAllSnd (a :: k) (xs :: [(k1, k2)]) :: [(k1, k)] where ...
Documentation
type family AllAre (a :: k) (ts :: [k]) where ... Source #
Constraint that every element of a promoted list is equal to a particular type. That is, the list of types is a single type repeated some number of times.
type family ReplaceAll (a2 :: a) (xs :: [a1]) :: [a] where ... Source #
ReplaceAll x ys
produces a type-level list of the same length
as ys
where each element is x
. In other words, it replaces each
element of ys
with x
. This would be map (const x) ys
in
value-level Haskell.
Equations
ReplaceAll (a3 :: a1) ('[] :: [a2]) = '[] :: [a1] | |
ReplaceAll (a3 :: a1) (x ': xs :: [a2]) = a3 ': ReplaceAll a3 xs |
type family ReplaceAllSnd (a :: k) (xs :: [(k1, k2)]) :: [(k1, k)] where ... Source #
Replace the second component of every tuple in a type-level list with a constant.
Equations
ReplaceAllSnd (a :: k) ('[] :: [(k1, k2)]) = '[] :: [(k1, k)] | |
ReplaceAllSnd (a :: k) ('(s, x) ': xs :: [(k1, k2)]) = '(s, a) ': ReplaceAllSnd a xs |