This commit is contained in:
Danny Navarro
2015-09-18 14:55:59 +02:00
parent dac6721f02
commit c9c1137ceb
5 changed files with 24 additions and 20 deletions

View File

@ -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

View File

@ -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