type-fun-0.1.2: Collection of widely reimplemented type families

Safe HaskellNone
LanguageHaskell2010

TypeFun.Data.Maybe

Synopsis

Documentation

type family MaybeCase (a :: Maybe k) (nothing :: r) (just :: k -> r) :: r where ... Source #

Equations

MaybeCase Nothing nothing just = nothing 
MaybeCase (Just k) nothing just = just k 

type family NothingToConstr (a :: Maybe k) (c :: Constraint) :: Constraint where ... Source #

Equations

NothingToConstr Nothing c = c 
NothingToConstr (Just a) c = () 

type family JustToConstr (a :: Maybe k) (c :: Constraint) :: Constraint where ... Source #

Equations

JustToConstr Nothing c = () 
JustToConstr (Just a) c = c 

type family CatMaybes (l :: [Maybe k]) :: [k] where ... Source #

Like catMaybes for type lists

Equations

CatMaybes '[] = '[] 
CatMaybes (Just a ': as) = a ': CatMaybes as 
CatMaybes (Nothing ': as) = CatMaybes as 

type family FromJust (a :: Maybe k) :: k where ... Source #

Equations

FromJust (Just a) = a