diff options
| author | Danny Navarro <j@dannynavarro.net> | 2016-02-15 14:25:15 +0100 |
|---|---|---|
| committer | Danny Navarro <j@dannynavarro.net> | 2016-02-15 14:43:52 +0100 |
| commit | 98d2d41cda148cd086099f3c2c2bc2ba70d9cfba (patch) | |
| tree | c792485bf175d8d068a10996c455b3c574349ca3 /Data/GraphQL/Schema.hs | |
| parent | 119f94b38e66f0e321f99b2489c3008e3585d76e (diff) | |
| download | graphql-98d2d41cda148cd086099f3c2c2bc2ba70d9cfba.tar.gz | |
Initial support for variable substitution
The correspondent end-to-end test has been ported. The variable
definition still needs to be checked.
Diffstat (limited to 'Data/GraphQL/Schema.hs')
| -rw-r--r-- | Data/GraphQL/Schema.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Data/GraphQL/Schema.hs b/Data/GraphQL/Schema.hs index 8ceb11f..8d63696 100644 --- a/Data/GraphQL/Schema.hs +++ b/Data/GraphQL/Schema.hs @@ -4,10 +4,11 @@ module Data.GraphQL.Schema where #if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>)) #endif +import Data.String (IsString(fromString)) import Data.Aeson (ToJSON(toJSON)) import Data.HashMap.Strict (HashMap) -import Data.Text (Text) +import Data.Text (Text, pack) data Schema f = Schema (QueryRoot f) -- (Maybe MutationRoot) @@ -25,6 +26,8 @@ data Output = OutputObject (HashMap Text Output) type Argument = (Text, Scalar) +type Subs = Text -> Maybe Scalar + data Input = InputField Text [Argument] [Input] deriving (Show) @@ -36,6 +39,9 @@ data Scalar = ScalarInt Int | ScalarID Text deriving (Show) +instance IsString Scalar where + fromString = ScalarString . pack + instance ToJSON Scalar where toJSON (ScalarInt x) = toJSON x toJSON (ScalarFloat x) = toJSON x |
