constrained-dynamic-0.1.0.0: Dynamic typing with retained constraints

Safe HaskellNone
LanguageHaskell2010

Data.Type.LTDict

Description

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.

Synopsis

Documentation

data MaybeHasClass :: (* -> Constraint) -> * -> * where Source #

Optionally provide a dictionary for a constraint and a type.

Constructors

JustHasClass :: cs t => MaybeHasClass cs t 
DoesNotHaveClass :: MaybeHasClass cs t 

Instances

data LTDict :: [* -> Constraint] -> * -> * where Source #

Maintain a list of dictionaries encapsulating many constraints over a single type (where they are available).

Constructors

LTDCons :: MaybeHasClass cs t -> LTDict css t -> LTDict (cs ': css) t 
LTDNil :: LTDict '[] t 

Instances

LTDictBuilder * LTDict ([] (* -> Constraint)) t Source # 

Methods

buildLTDict :: [* -> Constraint] t t Source #

(HasClass * cs t f, TypeConstraintBuilder Bool * MaybeHasClass cs t f, LTDictBuilder * LTDict css t) => LTDictBuilder * LTDict ((:) (* -> Constraint) cs css) t Source # 

Methods

buildLTDict :: ((* -> Constraint) ': cs) css t t Source #

class TypeConstraintBuilder mhctype cs t flag where Source #

Minimal complete definition

buildTypeConstraint

Methods

buildTypeConstraint :: proxy flag -> mhctype cs t Source #

Instances

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.

Minimal complete definition

buildLTDict

Methods

buildLTDict :: dtype css t Source #

Instances

LTDictBuilder * LTDict ([] (* -> Constraint)) t Source # 

Methods

buildLTDict :: [* -> Constraint] t t Source #

(HasClass * cs t f, TypeConstraintBuilder Bool * MaybeHasClass cs t f, LTDictBuilder * LTDict css t) => LTDictBuilder * LTDict ((:) (* -> Constraint) cs css) t Source # 

Methods

buildLTDict :: ((* -> Constraint) ': cs) css t t Source #

class LTDictConstraintLister css where Source #

Functions for extracting the list of constraints in an LTDict as TypeReps of ClassConstraint types.

class LTDictSearch css cs where Source #

A class for handling searches for a specific single constraint in the list.

Minimal complete definition

ltdSearch

Methods

ltdSearch :: proxy cs -> LTDict css a -> MaybeHasClass cs a Source #

Instances

LTDictSearch ([] (* -> Constraint)) cs Source # 

Methods

ltdSearch :: proxy cs -> LTDict [* -> Constraint] a -> MaybeHasClass cs a Source #

LTDictSearch css cs => LTDictSearch ((:) (* -> Constraint) unmatched css) cs Source # 

Methods

ltdSearch :: proxy cs -> LTDict (((* -> Constraint) ': unmatched) css) a -> MaybeHasClass cs a Source #

LTDictSearch ((:) (* -> Constraint) cs css) cs Source # 

Methods

ltdSearch :: proxy cs -> LTDict (((* -> Constraint) ': cs) css) a -> MaybeHasClass cs a Source #