forked from OSS/graphql
Initial stub for a GraphQL
and execute
This commit is contained in:
parent
c8f629e826
commit
8e3bae4b5c
14
Data/GraphQL/Execute.hs
Normal file
14
Data/GraphQL/Execute.hs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{-# LANGUAGE CPP #-}
|
||||||
|
module Data.GraphQL.Execute where
|
||||||
|
|
||||||
|
#if !MIN_VERSION_base(4,8,0)
|
||||||
|
import Control.Applicative (Applicative)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
import qualified Data.Aeson as Aeson (Value)
|
||||||
|
|
||||||
|
import Data.GraphQL.AST
|
||||||
|
import Data.GraphQL.Schema
|
||||||
|
|
||||||
|
execute :: Applicative f => Schema -> Document -> f Aeson.Value
|
||||||
|
execute = undefined
|
51
Data/GraphQL/Schema.hs
Normal file
51
Data/GraphQL/Schema.hs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
module Data.GraphQL.Schema where
|
||||||
|
|
||||||
|
import Data.Text (Text)
|
||||||
|
import Data.HashMap.Lazy (HashMap)
|
||||||
|
|
||||||
|
data Schema = Schema QueryRoot MutationRoot
|
||||||
|
|
||||||
|
type QueryRoot = ObjectOutput
|
||||||
|
|
||||||
|
type MutationRoot = ObjectOutput
|
||||||
|
|
||||||
|
type ObjectOutput = HashMap Text Output
|
||||||
|
|
||||||
|
type ObjectInput = HashMap Text Input
|
||||||
|
|
||||||
|
data Type = TypeScalar Scalar
|
||||||
|
| TypeOutputObject ObjectOutput
|
||||||
|
| TypeInterface Interface
|
||||||
|
| TypeUnion Union
|
||||||
|
| TypeEnum Scalar
|
||||||
|
| TypeInputObject ObjectInput
|
||||||
|
| TypeList List
|
||||||
|
| TypeNonNull NonNull
|
||||||
|
|
||||||
|
data Output = OutputScalar Scalar
|
||||||
|
| OutputObject ObjectOutput
|
||||||
|
| OutputInterface Interface
|
||||||
|
| OutputUnion Union
|
||||||
|
| OutputEnum Scalar
|
||||||
|
| OutputList List
|
||||||
|
| OutputNonNull NonNull
|
||||||
|
|
||||||
|
data Input = InputScalar Scalar
|
||||||
|
| InputObject ObjectInput
|
||||||
|
| InputEnum Scalar
|
||||||
|
| InputList List
|
||||||
|
| InputNonNull NonNull
|
||||||
|
|
||||||
|
data Scalar = ScalarInt Int
|
||||||
|
| ScalarFloat Double
|
||||||
|
| ScalarString Text
|
||||||
|
| ScalarBool Bool
|
||||||
|
| ScalarID Text
|
||||||
|
|
||||||
|
newtype Interface = Interface (HashMap Text Output)
|
||||||
|
|
||||||
|
newtype Union = Union [ObjectOutput]
|
||||||
|
|
||||||
|
type List = [Type]
|
||||||
|
|
||||||
|
type NonNull = Type
|
@ -24,10 +24,14 @@ library
|
|||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
exposed-modules: Data.GraphQL.AST
|
exposed-modules: Data.GraphQL.AST
|
||||||
Data.GraphQL.Encoder
|
Data.GraphQL.Encoder
|
||||||
|
Data.GraphQL.Execute
|
||||||
|
Data.GraphQL.Schema
|
||||||
Data.GraphQL.Parser
|
Data.GraphQL.Parser
|
||||||
build-depends: base >=4.7 && < 5,
|
build-depends: base >=4.7 && < 5,
|
||||||
text >=0.11.3.1,
|
text >=0.11.3.1,
|
||||||
attoparsec >=0.10.4.0
|
aeson >=0.7.0.3,
|
||||||
|
attoparsec >=0.10.4.0,
|
||||||
|
unordered-containers >=0.2.5.0
|
||||||
|
|
||||||
test-suite tasty
|
test-suite tasty
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
@ -2,4 +2,4 @@ flags: {}
|
|||||||
packages:
|
packages:
|
||||||
- '.'
|
- '.'
|
||||||
extra-deps: []
|
extra-deps: []
|
||||||
resolver: lts-3.4
|
resolver: lts-3.9
|
||||||
|
Loading…
Reference in New Issue
Block a user