servant-swagger-1.1.3.1: Generate Swagger specification for your servant API.

Safe Haskell | None
Language | Haskell2010

Servant.Swagger.Internal.TypeLevel.Every

Synopsis

- type family EveryTF cs x :: Constraint where ...
- class EveryTF cs x => Every cs x
- tmapEvery :: forall a cs p p'' xs. TMap (Every cs) xs => p cs -> (forall x p'. Every cs x => p' x -> a) -> p'' xs -> [a]

# Documentation

    >>> :set -XDataKinds
    >>> :set -XFlexibleContexts
    >>> :set -XGADTs
    >>> :set -XRankNTypes
    >>> :set -XScopedTypeVariables
    >>> import GHC.TypeLits
    >>> import Data.List

type family EveryTF cs x :: Constraint where ... #

Apply multiple constraint constructors to a type.

    EveryTF '[Show, Read] a ~ (Show a, Read a)

Note that since this is a type family, you have to alway fully apply ``EveryTF``.

For partial application of multiple constraint constructors see ``Every``.

Equations

EveryTF '[] x = () |
EveryTF (c ': cs) x = (c x, EveryTF cs x) |

class EveryTF cs x => Every cs x #

Apply multiple constraint constructors to a type as a class.

This is different from ``EveryTF`` in that it allows partial application.

Instances

Every ([] (* -> Constraint)) x # |
(c x, Every cs x) => Every ((:) (* -> Constraint) c cs) x # |

tmapEvery :: forall a cs p p'' xs. TMap (Every cs) xs => p cs -> (forall x p'. Every cs x => p' x -> a) -> p'' xs -> [a] #

Like ``tmap``, but uses ``Every`` for multiple constraints.

    >>> let zero :: forall p a. (Show a, Num a) => p a -> String; zero _ = show (0 :: a)
    >>> tmapEvery (Proxy :: Proxy [Show, Num]) zero (Proxy :: Proxy [Int, Float]) :: [String]
    ["0","0.0"]