{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
module Data.Morpheus.Kind
( SCALAR,
OBJECT,
ENUM,
WRAPPER,
UNION,
INPUT_OBJECT,
GQL_KIND,
OUTPUT,
INPUT,
INTERFACE,
ToValue (..),
isObject,
)
where
import Relude
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 :: f 'SCALAR -> GQL_KIND
toValue f 'SCALAR
_ = GQL_KIND
SCALAR
instance ToValue 'ENUM where
toValue :: f 'ENUM -> GQL_KIND
toValue f 'ENUM
_ = GQL_KIND
ENUM
instance ToValue 'WRAPPER where
toValue :: f 'WRAPPER -> GQL_KIND
toValue f 'WRAPPER
_ = GQL_KIND
WRAPPER
instance ToValue 'INPUT where
toValue :: f 'INPUT -> GQL_KIND
toValue f 'INPUT
_ = GQL_KIND
INPUT
instance ToValue 'OUTPUT where
toValue :: f 'OUTPUT -> GQL_KIND
toValue f 'OUTPUT
_ = GQL_KIND
OUTPUT
instance ToValue 'INTERFACE where
toValue :: f 'INTERFACE -> GQL_KIND
toValue f 'INTERFACE
_ = GQL_KIND
INTERFACE
isObject :: GQL_KIND -> Bool
isObject :: GQL_KIND -> Bool
isObject GQL_KIND
INPUT = Bool
True
isObject GQL_KIND
OUTPUT = Bool
True
isObject GQL_KIND
INTERFACE = Bool
True
isObject GQL_KIND
_ = Bool
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