constrained-dynamic- Dynamic typing with retained constraints

Safe HaskellNone




data TDict c t where Source #

Stores a constraint context. When pattern matched upon, the compiler knows the constraint is true.


TDict :: c t => TDict c t 

class HasClass c t b | c t -> b where Source #

Identifies whether or not a type has an instance of a type class, and provides a standard means for capturing a context that allows them to be used. Unfortunately, because instances cannot be selected on the basis of whether a context matches, instances of this class need to be listed manually whenever we need to modify behaviour depending on whether an instance of a class is available or not. If a class c has an instance for type t there should be an instance HasClass c t True where classDict _ _ _ = TDict. For cases where additional context is required, see examples in the Data.Type.HasClassPreludeInstances module.

Minimal complete definition



classDict :: Proxy c -> Proxy t -> Proxy b -> TDict c t Source #


(~) Bool False b => HasClass k c t b Source #

Default instance for types and classes that do not have an available instance.


classDict :: Proxy (c -> Constraint) t -> Proxy c b -> Proxy Bool b -> TDict c t b Source #

class And a b c | a b -> c Source #

Combine type level Bools. And a b c has an instance And a b True if and only if both a and b are True, and And a b False otherwise.