constraints-0.8: Constraint manipulation

Copyright | (C) 2011-2015 Edward Kmett, (C) 2015 Ørjan Johansen
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | experimental
Portability | non-portable
Safe Haskell | Trustworthy
Language | Haskell2010

Data.Constraint.Forall

Description

This module uses a trick to provide quantification over constraints.

Synopsis

- type family Forall (p :: k -> Constraint) :: Constraint
- inst :: forall p a. Forall p :- p a
- type family ForallF (p :: k2 -> Constraint) (f :: k1 -> k2) :: Constraint
- instF :: forall p f a. ForallF p f :- p (f a)
- type Forall1 p = Forall p
- inst1 :: forall p f. Forall p :- p f
- type family ForallT (p :: k3 -> Constraint) (t :: k1 -> k2 -> k3) :: Constraint
- instT :: forall p t f a. ForallT p t :- p (t f a)

# Documentation

type family Forall (p :: k -> Constraint) :: Constraint #

A representation of the quantified constraint `forall a. p a`.

Instances

type Forall k p # |
type Forall k p

inst :: forall p a. Forall p :- p a #

Instantiate a quantified ``Forall` p` constraint at type `a`.

type family ForallF (p :: k2 -> Constraint) (f :: k1 -> k2) :: Constraint #

A representation of the quantified constraint `forall a. p (f a)`.

Instances

type ForallF k1 k2 p f # |
type ForallF k1 k2 p f

instF :: forall p f a. ForallF p f :- p (f a) #

Instantiate a quantified ``ForallF` p f` constraint at type `a`.

type Forall1 p = Forall p #

inst1 :: forall p f. Forall p :- p f #

Instantiate a quantified constraint on kind `* -> *`. This is now redundant since ``inst`` became polykinded.

type family ForallT (p :: k3 -> Constraint) (t :: k1 -> k2 -> k3) :: Constraint #

A representation of the quantified constraint `forall f a. p (t f a)`.

Instances

type ForallT k2 k1 k3 p t # |
type ForallT k2 k1 k3 p t

instT :: forall p t f a. ForallT p t :- p (t f a) #

Instantiate a quantified ``ForallT` p t` constraint at types `f` and `a`.