From c9c1137cebe5629f145f55fc941cb09ce7b3d02a Mon Sep 17 00:00:00 2001 From: Danny Navarro Date: Fri, 18 Sep 2015 14:55:59 +0200 Subject: Garden --- Data/GraphQL/AST.hs | 4 ++-- Data/GraphQL/Parser.hs | 17 +++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'Data') diff --git a/Data/GraphQL/AST.hs b/Data/GraphQL/AST.hs index 0a09671..422ce9e 100644 --- a/Data/GraphQL/AST.hs +++ b/Data/GraphQL/AST.hs @@ -61,8 +61,8 @@ type TypeCondition = NamedType -- * Values data Value = ValueVariable Variable - | ValueInt Int -- TODO: Should this be `Integer`? - | ValueFloat Double -- TODO: Should this be `Scientific`? + | ValueInt Int + | ValueFloat Double | ValueBoolean Bool | ValueString Text | ValueEnum Name diff --git a/Data/GraphQL/Parser.hs b/Data/GraphQL/Parser.hs index c999004..fa8c532 100644 --- a/Data/GraphQL/Parser.hs +++ b/Data/GraphQL/Parser.hs @@ -148,16 +148,17 @@ typeCondition = namedType -- explicit types use the `typedValue` parser. value :: Parser Value value = ValueVariable <$> variable - -- TODO: Handle arbitrary precision. - <|> ValueInt <$> tok (signed decimal) - <|> ValueFloat <$> tok (signed double) - <|> ValueBoolean <$> bool + -- TODO: Handle maxBound, Int32 in spec. + <|> ValueInt <$> tok (signed decimal) + -- There is a stock `parser` for double but not for float. + <|> ValueFloat <$> tok (signed double) + <|> ValueBoolean <$> bool -- TODO: Handle escape characters, unicode, etc - <|> ValueString <$> quotes name + <|> ValueString <$> quotes name -- `true` and `false` have been tried before - <|> ValueEnum <$> name - <|> ValueList <$> listValue - <|> ValueObject <$> objectValue + <|> ValueEnum <$> name + <|> ValueList <$> listValue + <|> ValueObject <$> objectValue -- Notice it can be empty listValue :: Parser ListValue -- cgit v1.2.3