{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
#if __GLASGOW_HASKELL__ >= 800
{-# LANGUAGE UndecidableSuperClasses #-}
#endif
module Servant.Swagger.Internal.TypeLevel.Every where
import Data.Proxy
import GHC.Exts (Constraint)
import Servant.Swagger.Internal.TypeLevel.TMap
type family EveryTF cs x :: Constraint where
EveryTF '[] x = ()
EveryTF (c ': cs) x = (c x, EveryTF cs x)
class EveryTF cs x => Every (cs :: [* -> Constraint]) (x :: *) where
instance Every '[] x where
instance (c x, Every cs x) => Every (c ': cs) x where
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]
tmapEvery _ = tmap (Proxy :: Proxy (Every cs))