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

View File

@ -21,6 +21,6 @@ See the TODO file for more concrete tasks.
Suggestions, contributions and bug reports are welcome.
Feel free to contact me, jdnavarro, on the #haskell channel on the
[GraphQL Slack Server](https://graphql.slack.com). You can obtain an
Feel free to contact on Slack in [#haskell on
GraphQL](https://graphql.slack.com/messages/haskell/). You can obtain an
invitation [here](https://graphql-slack.herokuapp.com/).

18
TODO
View File

@ -1,21 +1,23 @@
## AST
- Simplify unnecessary `newtypes` with type synonyms
- Simplify wrapper type constructors. Some types can be just constructors.
- Data type accessors
- Deal with Strictness/unboxing
- Deal with Location
- Deal with strictness/unboxing
- Deal with location
## Parser
- Secure Names
- Optimize `name` and `whiteSpace`: `take...`, `T.fold`, ...
- Handle escape characters in string literals
- Guard for `on` in `FragmentSpread`
- Tests!
- Handle `[Const]` grammar parameter. Need examples
- Arbitrary precision for number values?
- Handle errors. Perhaps port to `parsers` or use a lexer and
`regex-applicative`
- Handle `maxBound` Int values.
- Diagnostics. Perhaps port to `parsers` and use `trifecta` for diagnostics,
and `attoparsec` for performance.
- Improve comment handling: perhaps front the main parser with a lexer.
## Tests
- Golden data within package, `path_graphql` macro.
- Pretty Print golden result
- Pretty print golden result
## Docs!

View File

@ -34,6 +34,7 @@ test-suite golden
hs-source-dirs: tests
main-is: golden.hs
ghc-options: -Wall
other-modules: Paths_graphql
build-depends: base >= 4.6 && <5,
bytestring,
text,