{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE NoImplicitPrelude #-}
module Data.Morpheus.Server.Deriving.Utils.Kinded
( KindedProxy (..),
setType,
setKind,
kinded,
KindedType (..),
inputType,
outputType,
CategoryValue (..),
)
where
import Data.Morpheus.Types.Internal.AST
( IN,
LEAF,
OUT,
TypeCategory (..),
)
import Prelude (Show)
class CategoryValue (c :: TypeCategory) where
categoryValue :: f c -> TypeCategory
instance CategoryValue OUT where
categoryValue :: forall (f :: TypeCategory -> *). f 'OUT -> TypeCategory
categoryValue f 'OUT
_ = TypeCategory
OUT
instance CategoryValue IN where
categoryValue :: forall (f :: TypeCategory -> *). f 'IN -> TypeCategory
categoryValue f 'IN
_ = TypeCategory
IN
instance CategoryValue LEAF where
categoryValue :: forall (f :: TypeCategory -> *). f LEAF -> TypeCategory
categoryValue f LEAF
_ = TypeCategory
LEAF
data KindedProxy k a
= KindedProxy
setType :: f a -> kinded (k :: t) a' -> KindedProxy k a
setType :: forall {k} {k} (f :: k -> *) (a :: k) t (kinded :: t -> k -> *)
(k :: t) (a' :: k).
f a -> kinded k a' -> KindedProxy k a
setType f a
_ kinded k a'
_ = forall {k} {k} (k :: k) (a :: k). KindedProxy k a
KindedProxy
setKind :: f k -> kinded (k' :: t) a -> KindedProxy k a
setKind :: forall {k} {k} (f :: k -> *) (k :: k) t (kinded :: t -> k -> *)
(k' :: t) (a :: k).
f k -> kinded k' a -> KindedProxy k a
setKind f k
_ kinded k' a
_ = forall {k} {k} (k :: k) (a :: k). KindedProxy k a
KindedProxy
kinded :: f k -> f' a -> KindedProxy k a
kinded :: forall {k} {k} (f :: k -> *) (k :: k) (f' :: k -> *) (a :: k).
f k -> f' a -> KindedProxy k a
kinded f k
_ f' a
_ = forall {k} {k} (k :: k) (a :: k). KindedProxy k a
KindedProxy
data KindedType (cat :: TypeCategory) a where
InputType :: KindedType IN a
OutputType :: KindedType OUT a
deriving instance Show (KindedType cat a)
inputType :: f a -> KindedType IN a
inputType :: forall {k} (f :: k -> *) (a :: k). f a -> KindedType 'IN a
inputType f a
_ = forall {k} (a :: k). KindedType 'IN a
InputType
outputType :: f a -> KindedType OUT a
outputType :: forall {k} (f :: k -> *) (a :: k). f a -> KindedType 'OUT a
outputType f a
_ = forall {k} (a :: k). KindedType 'OUT a
OutputType