{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
module Data.Morpheus.Kind
( SCALAR,
OBJECT,
ENUM,
WRAPPER,
UNION,
INPUT_OBJECT,
GQL_KIND,
OUTPUT,
INPUT,
INTERFACE,
ToValue (..),
isObject,
)
where
data GQL_KIND
= SCALAR
| ENUM
| INPUT
| OUTPUT
| WRAPPER
| INTERFACE
class ToValue (a :: GQL_KIND) where
toValue :: f a -> GQL_KIND
instance ToValue 'SCALAR where
toValue _ = SCALAR
instance ToValue 'ENUM where
toValue _ = ENUM
instance ToValue 'WRAPPER where
toValue _ = WRAPPER
instance ToValue 'INPUT where
toValue _ = INPUT
instance ToValue 'OUTPUT where
toValue _ = OUTPUT
instance ToValue 'INTERFACE where
toValue _ = INTERFACE
isObject :: GQL_KIND -> Bool
isObject INPUT = True
isObject OUTPUT = True
isObject INTERFACE = True
isObject _ = False
type SCALAR = 'SCALAR
type ENUM = 'ENUM
type WRAPPER = 'WRAPPER
type OUTPUT = 'OUTPUT
type INPUT = 'INPUT
{-# DEPRECATED INPUT_OBJECT "use more generalized kind: INPUT" #-}
type INPUT_OBJECT = 'INPUT
{-# DEPRECATED UNION "use: deriving(GQLType), IMPORTANT: only types with <type constructor name><constructor name> will sustain their form, other union constructors will be wrapped inside an new object" #-}
type UNION = 'OUTPUT
{-# DEPRECATED OBJECT "use: deriving(GQLType), will be automatically inferred" #-}
type OBJECT = 'OUTPUT
type INTERFACE = 'INTERFACE