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 -- * Values
data Value = ValueVariable Variable data Value = ValueVariable Variable
| ValueInt Int -- TODO: Should this be `Integer`? | ValueInt Int
| ValueFloat Double -- TODO: Should this be `Scientific`? | ValueFloat Double
| ValueBoolean Bool | ValueBoolean Bool
| ValueString Text | ValueString Text
| ValueEnum Name | ValueEnum Name

View File

@ -148,8 +148,9 @@ typeCondition = namedType
-- explicit types use the `typedValue` parser. -- explicit types use the `typedValue` parser.
value :: Parser Value value :: Parser Value
value = ValueVariable <$> variable value = ValueVariable <$> variable
-- TODO: Handle arbitrary precision. -- TODO: Handle maxBound, Int32 in spec.
<|> ValueInt <$> tok (signed decimal) <|> ValueInt <$> tok (signed decimal)
-- There is a stock `parser` for double but not for float.
<|> ValueFloat <$> tok (signed double) <|> ValueFloat <$> tok (signed double)
<|> ValueBoolean <$> bool <|> ValueBoolean <$> bool
-- TODO: Handle escape characters, unicode, etc -- TODO: Handle escape characters, unicode, etc

View File

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

18
TODO
View File

@ -1,21 +1,23 @@
## AST ## AST
- Simplify unnecessary `newtypes` with type synonyms - Simplify unnecessary `newtypes` with type synonyms
- Simplify wrapper type constructors. Some types can be just constructors.
- Data type accessors - Data type accessors
- Deal with Strictness/unboxing - Deal with strictness/unboxing
- Deal with Location - Deal with location
## Parser ## Parser
- Secure Names - Secure Names
- Optimize `name` and `whiteSpace`: `take...`, `T.fold`, ... - Optimize `name` and `whiteSpace`: `take...`, `T.fold`, ...
- Handle escape characters in string literals - Handle escape characters in string literals
- Guard for `on` in `FragmentSpread` - Guard for `on` in `FragmentSpread`
- Tests!
- Handle `[Const]` grammar parameter. Need examples - Handle `[Const]` grammar parameter. Need examples
- Arbitrary precision for number values? - Handle `maxBound` Int values.
- Handle errors. Perhaps port to `parsers` or use a lexer and - Diagnostics. Perhaps port to `parsers` and use `trifecta` for diagnostics,
`regex-applicative` and `attoparsec` for performance.
- Improve comment handling: perhaps front the main parser with a lexer.
## Tests ## 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 hs-source-dirs: tests
main-is: golden.hs main-is: golden.hs
ghc-options: -Wall ghc-options: -Wall
other-modules: Paths_graphql
build-depends: base >= 4.6 && <5, build-depends: base >= 4.6 && <5,
bytestring, bytestring,
text, text,