Safe Haskell | None |
---|---|
Language | Haskell2010 |
Provides a type for keeping a list of typeclass dictionaries that may or may not exist for a given type, and utility functions for working with the list.
- data MaybeHasClass :: (* -> Constraint) -> * -> * where
- JustHasClass :: cs t => MaybeHasClass cs t
- DoesNotHaveClass :: MaybeHasClass cs t
- data LTDict :: [* -> Constraint] -> * -> * where
- class TypeConstraintBuilder mhctype cs t flag where
- checkClass :: forall cs t f. (HasClass cs t f, TypeConstraintBuilder MaybeHasClass cs t f) => MaybeHasClass cs t
- class LTDictBuilder dtype css t where
- class LTDictConstraintLister css where
- class LTDictSearch css cs where
Documentation
data MaybeHasClass :: (* -> Constraint) -> * -> * where Source #
Optionally provide a dictionary for a constraint and a type.
JustHasClass :: cs t => MaybeHasClass cs t | |
DoesNotHaveClass :: MaybeHasClass cs t |
(~) Bool f False => TypeConstraintBuilder Bool * MaybeHasClass cs t f Source # | |
HasClass * cs t True => TypeConstraintBuilder Bool * MaybeHasClass cs t True Source # | |
data LTDict :: [* -> Constraint] -> * -> * where Source #
Maintain a list of dictionaries encapsulating many constraints over a single type (where they are available).
LTDictBuilder * LTDict ([] (* -> Constraint)) t Source # | |
(HasClass * cs t f, TypeConstraintBuilder Bool * MaybeHasClass cs t f, LTDictBuilder * LTDict css t) => LTDictBuilder * LTDict ((:) (* -> Constraint) cs css) t Source # | |
class TypeConstraintBuilder mhctype cs t flag where Source #
buildTypeConstraint :: proxy flag -> mhctype cs t Source #
(~) Bool f False => TypeConstraintBuilder Bool * MaybeHasClass cs t f Source # | |
HasClass * cs t True => TypeConstraintBuilder Bool * MaybeHasClass cs t True Source # | |
checkClass :: forall cs t f. (HasClass cs t f, TypeConstraintBuilder MaybeHasClass cs t f) => MaybeHasClass cs t Source #
Produce an appropriate MaybeHasClass
value for the context.
Callers should ensure that appropriate HasClass
instances are in scope
at the point of calling, or declare them as part of their context.
class LTDictBuilder dtype css t where Source #
A class for building objects that recurse over a list of constraints.
Instances are provided for building LTDict
values, but could be used
for other values too.
buildLTDict :: dtype css t Source #
LTDictBuilder * LTDict ([] (* -> Constraint)) t Source # | |
(HasClass * cs t f, TypeConstraintBuilder Bool * MaybeHasClass cs t f, LTDictBuilder * LTDict css t) => LTDictBuilder * LTDict ((:) (* -> Constraint) cs css) t Source # | |
class LTDictConstraintLister css where Source #
Functions for extracting the list of constraints in an LTDict
as TypeRep
s of ClassConstraint
types.
getAllConstraints :: LTDict css a -> [TypeRep] Source #
getMatchedConstraints :: LTDict css a -> [TypeRep] Source #
getUnmatchedConstraints :: LTDict css a -> [TypeRep] Source #
LTDictConstraintLister ([] (* -> Constraint)) Source # | |
(Typeable (* -> Constraint) cs, LTDictConstraintLister css) => LTDictConstraintLister ((:) (* -> Constraint) cs css) Source # | |
class LTDictSearch css cs where Source #
A class for handling searches for a specific single constraint in the list.
ltdSearch :: proxy cs -> LTDict css a -> MaybeHasClass cs a Source #
LTDictSearch ([] (* -> Constraint)) cs Source # | |
LTDictSearch css cs => LTDictSearch ((:) (* -> Constraint) unmatched css) cs Source # | |
LTDictSearch ((:) (* -> Constraint) cs css) cs Source # | |