Commit Graph

38 Commits

Author SHA1 Message Date
Eugen Wissner 91679650b5 Introduce monad transformer for resolvers
Now the errors in the resolvers can be handled and 3 tests throwing
errors pass now. Another test fail but it requires distinguisching
nullable and non-nullable values.
2019-07-02 20:07:26 +02:00
Eugen Wissner f64e186c60 Move the source code into src/ 2019-06-30 06:07:32 +02:00
Eugen Wissner 79c734fa62 Replace Alternative with MonadPlus 2019-06-28 11:12:28 +02:00
Eugen Wissner 5e9bf9648d Parse queries with megaparsec 2019-06-21 10:44:58 +02:00
Eugen Wissner ce169ecef2 Add package.yaml, update stack snapshot to 13.25 2019-06-11 06:34:15 +02:00
Danny Navarro 693b7d18dc
Introduce Tranform module
In the Transform module the Full AST will converted to Core AST.

This commit also includes a partial implementation of Fragment replacement.
2017-02-02 12:44:03 -03:00
Danny Navarro 5390c4ca1e
Split AST in 2
One AST is meant to be a target parser and tries to adhere as much as possible
to the spec. The other is a simplified version of that AST meant for execution.

Also newtypes have been replaced by type synonyms and NonEmpty lists are being
used where it makes sense.
2017-01-28 14:15:14 -03:00
Tom Hunger 87c92e9d6e Parse number as scientific and interpret meaning separately.
The current parser will fail parsing floats because it parses an int,
and then stumbles on the dot.

To fix I interpret the value with the scientific library which already
is a dependency through attoparsec, so we're not introducing any extra
downloads or compiling.

I think this is still subtly wrong because "10.0" will be parsed as
ValueInt, but because input argument ints are allowed to be coerced
into doubles (according to the spec) this is probably acceptable.
2016-12-09 00:03:20 +00:00
Danny Navarro 61f0a06096
Drop support for GHC-7.8.4 2016-11-27 12:56:44 -03:00
Danny Navarro e944c76040 Add @Tritlo and @solrun as authors 2016-03-17 15:57:18 +01:00
solrun 61d6af7778 Added documentation of functions and modules and included tutorial.lhs. 2016-03-14 01:42:55 +01:00
Matthías Páll Gissurarson d195389102 Added exception handling with Alternative constraint according to spec. 2016-03-14 01:01:24 +01:00
Danny Navarro 04d8d40b3a Split StarWars tests in different modules 2016-02-12 13:27:46 +01:00
Danny Navarro a088c81944 Handle Field arguments in Schema definition
The `Schema` has been overhauled to make `Output` monomorphic.
Traversing the `GraphQL` document is handled implicitly while defining
the `Schema`.

The 4th end-to-end test from `graphql-js` has been ported.
2016-02-12 12:51:18 +01:00
Danny Navarro c385566912 Bump copyright year 2016-02-08 17:35:33 +01:00
Danny Navarro 1561e62489 Extend `execute` for deeper queries
The second graphql-js end-to-end test was ported and passed
successfully.
2016-02-08 17:30:18 +01:00
Danny Navarro c81ddb0335 Introduce `graphql` function
This simplifies Attoparsec parsing when executing a GraphQL
query.
2016-02-05 12:32:35 +01:00
Danny Navarro 78e0d871d5 Garden 2016-01-26 13:38:02 +01:00
Danny Navarro bb685c9afa Rough implementation of `execute`
The first end-to-end test taken from `graphql-js` passes but this still
needs to be extended to support more general cases.

- `Data.GraphQL.Schema` has been heavily modified to support the
  execution model. More drastic changes are expected in this module.
- When defining a `Schema` ordinary functions taking fields as input are
  being used instead of maps. This makes the implementation of `execute`
  easier, and, arguably, makes `Schema` definitions more *Haskellish*.
- Drop explicit `unordered-containers` dependency. `Aeson.Value`s and
  field functions should be good enough for now.
2016-01-26 12:43:18 +01:00
Danny Navarro 4e5dc3433a Implement first StarWars end-to-end test
`execute` still needs to be implemented.
2015-10-19 12:19:39 +02:00
Danny Navarro 3f30a44d1d Test fixtures for Schema toplevel
This includes simplications to the Schema data types.
2015-10-17 17:49:56 +02:00
Danny Navarro 8e3bae4b5c Initial stub for a `GraphQL` and `execute` 2015-10-17 13:23:49 +02:00
Danny Navarro 6ce2004264 Version Bump
This also includes updates to CHANGELOG, TODO and README.
2015-09-22 14:27:10 +02:00
Danny Navarro af42e5577c Rename `Data.GraphQL.Printer` -> `Data.GraphQL.Encoder` 2015-09-22 14:23:18 +02:00
Danny Navarro 06b3302862 Add kitchen sink parse/encode unit test
This also includes the fixes to make it work. Golden tests have been
removed.
2015-09-22 14:02:49 +02:00
Danny Navarro e74ee640a8 Initial implementation of GraphQL pretty printer
This just typechecks. It needs to be cleaned and tested. Tests have been
deactivated.
2015-09-21 18:26:22 +02:00
Danny Navarro c9c1137ceb Garden 2015-09-18 14:55:59 +02:00
Danny Navarro dac6721f02 Version bump and CHANGELOG 2015-09-16 11:16:16 +02:00
Danny Navarro b3482172a6 Add travis support 2015-09-16 10:51:53 +02:00
Danny Navarro f88948e801 Support ghc-7.8 2015-09-16 10:36:59 +02:00
Danny Navarro ee0e0c3d1f Use Cabal data-files to access golden tests data
Fixes #1.
2015-09-16 10:13:44 +02:00
Danny Navarro 7cf2b59331 Version bump, CHANGELOG and some gardening 2015-09-14 17:25:18 +02:00
Danny Navarro 8d81f43b61 Add golden test for kitchen-sink.graphql 2015-09-14 17:01:14 +02:00
Danny Navarro b4b8388392 Enable warnings and take care of extra imports 2015-09-14 15:48:47 +02:00
Danny Navarro 0e67fdc21c Add GraphQL parser
WIP: This parser just type checks, it hasn't even been tested manually.
Check new tasks in the TODO file and the TODO comments in the code for
more gotchas.
2015-09-13 13:55:15 +02:00
Danny Navarro 0f673b9b4d Rename module `Data.GraphQL` -> `Data.GraphQL.AST` 2015-09-12 15:16:28 +02:00
Danny Navarro 50a0c953d3 Garden 2015-09-12 13:09:06 +02:00
Danny Navarro 5af7136893 Initial commit
This includes a rough port of the data types at
https://github.com/graphql/graphql-js/blob/master/src/language/ast.js
2015-09-12 12:54:05 +02:00