summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Navarro <j@dannynavarro.net>2015-09-18 14:55:59 +0200
committerDanny Navarro <j@dannynavarro.net>2015-09-18 14:55:59 +0200
commitc9c1137cebe5629f145f55fc941cb09ce7b3d02a (patch)
treec73e033965f40b1e65c714dc4a585cc901fc7ce1
parentdac6721f02e747d218ad160c7be5d0483752faa5 (diff)
downloadgraphql-c9c1137cebe5629f145f55fc941cb09ce7b3d02a.tar.gz
Garden
-rw-r--r--Data/GraphQL/AST.hs4
-rw-r--r--Data/GraphQL/Parser.hs17
-rw-r--r--README.md4
-rw-r--r--TODO18
-rw-r--r--graphql.cabal1
5 files changed, 24 insertions, 20 deletions
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
diff --git a/README.md b/README.md
index 402e8d8..dd8928a 100644
--- a/README.md
+++ b/README.md
@@ -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/).
diff --git a/TODO b/TODO
index 9502263..6e61bf1 100644
--- a/TODO
+++ b/TODO
@@ -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!
diff --git a/graphql.cabal b/graphql.cabal
index 077064e..18684b1 100644
--- a/graphql.cabal
+++ b/graphql.cabal
@@ -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,