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

License | BSD-2 (see LICENSE) |

Maintainer | sergey@debian |

Safe Haskell | None |

Language | Haskell2010 |

## Synopsis

- class Constrained f => CFunctor f where
- cmap :: (Constraints f a, Constraints f b) => (a -> b) -> f a -> f b
- cmap_ :: (Constraints f a, Constraints f b) => a -> f b -> f a

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

# Documentation

class Constrained f => CFunctor f where Source #

Like `Functor`

but allows elements to have constraints on them.
Laws are the same:

cmap id == id cmap (f . g) == cmap f . cmap g

Nothing

cmap :: (Constraints f a, Constraints f b) => (a -> b) -> f a -> f b Source #

cmap_ :: (Constraints f a, Constraints f b) => a -> f b -> f a Source #

cmap :: (Functor f, Constraints f a, Constraints f b) => (a -> b) -> f a -> f b 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 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 #