3f30a44d1d
This includes simplications to the Schema data types.
37 lines
912 B
Haskell
37 lines
912 B
Haskell
module Data.GraphQL.Schema where
|
|
|
|
import Data.Text (Text)
|
|
import Data.HashMap.Lazy (HashMap)
|
|
|
|
data Schema f = Schema (QueryRoot f) (Maybe (MutationRoot f))
|
|
|
|
type QueryRoot f = Object f
|
|
|
|
type MutationRoot f = Object f
|
|
|
|
type Object f = HashMap Text (Input -> f Output)
|
|
|
|
type ObjectInput = HashMap Text Input
|
|
|
|
data Output = OutputScalar Scalar
|
|
| OutputObject (HashMap Text Output)
|
|
| OutputUnion [Output]
|
|
| OutputEnum Scalar
|
|
| OutputList [Output]
|
|
| OutputNonNull Output
|
|
| InputError
|
|
|
|
data Input = InputScalar Scalar
|
|
| InputObject ObjectInput
|
|
| InputEnum Scalar
|
|
| InputList [Output]
|
|
| InputNonNull Input
|
|
|
|
data Scalar = ScalarInt Int
|
|
| ScalarFloat Double
|
|
| ScalarString Text
|
|
| ScalarBool Bool
|
|
| ScalarID Text
|
|
|
|
newtype Interface f = Interface (Object f)
|