Copyright | (c) Sergey Vinokurov 2019 |
---|---|

License | BSD-2 (see LICENSE) |

Maintainer | sergey@debian |

Safe Haskell | Safe |

Language | Haskell2010 |

## Synopsis

- class Constrained (f :: k2 -> k1) where
- type Constraints (f :: k2 -> k1) :: k2 -> Constraint

- class NoConstraints (a :: k)
- class (Constraints f a, Constraints g a) => UnionConstraints (f :: k1 -> k2) (g :: k1 -> k2) (a :: k1)
- class (Constraints f (g a), Constraints g a) => ComposeConstraints (f :: k2 -> k1) (g :: k3 -> k2) (a :: k3)

# Documentation

class Constrained (f :: k2 -> k1) Source #

Specification of constrains that a functor might impose on its elements. For example, sets typically require that their elements are ordered and unboxed vectors require elements to have an instance of special class that allows them to be packed in memory.

NB The `Constraints`

type family is associated with a typeclass in
order to improve type inference. Whenever a typeclass constraint
will be present, instance is guaranteed to exist and typechecker is
going to take advantage of that.

type Constraints (f :: k2 -> k1) :: k2 -> Constraint Source #

## Instances

class NoConstraints (a :: k) Source #

Used to specify values for `Constraints`

type family to indicate
absence of any constraints (i.e. empty `Constraint`

).

## Instances

NoConstraints (a :: k) Source # | |

Defined in Data.Constrained |

class (Constraints f a, Constraints g a) => UnionConstraints (f :: k1 -> k2) (g :: k1 -> k2) (a :: k1) Source #

Combine constraints of two functors together to form a bigger set of constraints.

## Instances

(Constraints f a, Constraints g a) => UnionConstraints (f :: k1 -> k2) (g :: k1 -> k2) (a :: k1) Source # | |

Defined in Data.Constrained |

class (Constraints f (g a), Constraints g a) => ComposeConstraints (f :: k2 -> k1) (g :: k3 -> k2) (a :: k3) Source #

Combine constraints for a case when one functors contains the other one.

## Instances

(Constraints f (g a), Constraints g a) => ComposeConstraints (f :: k2 -> k1) (g :: k3 -> k2) (a :: k3) Source # | |

Defined in Data.Constrained |