diff options
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 |
