Skip to content

Commit 87b19b5

Browse files
committed
jml tweaks to README
1 parent 7a6caa5 commit 87b19b5

File tree

1 file changed

+41
-11
lines changed

1 file changed

+41
-11
lines changed

README.md

+41-11
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,33 @@
33
[![CircleCI](https://circleci.com/gh/jml/graphql-api.svg?style=shield)](https://circleci.com/gh/jml/graphql-api)
44
[![Documentation Status](https://readthedocs.org/projects/haskell-graphql-api/badge/?version=latest)](http://haskell-graphql-api.readthedocs.io/en/latest/?badge=latest)
55

6-
This library provides type combinators to create a GraphQL schema, and functions to parse and evaluate queries against the schema. It is inspired by [servant](http://haskell-servant.readthedocs.io/en/stable/) but the two projects don't share any code.
6+
`graphql-api` helps you implement a robust [GraphQL](http://graphql.org/) API in Haskell. By the time a query makes it to your handler you are dealing with strong, static types that make sense for your problem domain. All your handlers are normal Haskell functions because we derive their type signature from the schema. If you have used [servant](http://haskell-servant.readthedocs.io/en/stable/), this will sound familiar.
77

8-
More specifically, `graphql-api` helps with implementing a robust GraphQL API in Haskell. By the time a query makes it to your handler you are dealing with strong, static types. All handlers are normal Haskell functions because we derive their type signature from the schema.
8+
The library provides type combinators to create a GraphQL schema, and functions to parse and evaluate queries against the schema.
99

1010
You can find the latest release on [hackage](https://hackage.haskell.org/package/graphql-api).
1111

12-
Note that we're trying to implement the GraphQL standard as best as we can in Haskell. I.e. even if an alternative API or behaviour looks nicer we will defer to the standard.
12+
We implement the [GraphQL specification](https://facebook.github.io/graphql/) as best as we can in Haskell. We figure they know what they're doing. Even if an alternative API or behaviour looks nicer, we will defer to the spec.
1313

14-
## Hello world example
14+
## Example
1515

16-
Below we define a `Hello` Schema that contains a single field, `greeting`, that takes a single, required argument `who`:
16+
Say we have a simple GraphQL schema like:
17+
18+
```graphql
19+
type Hello {
20+
greeting(who: String!): String!
21+
}
22+
```
23+
24+
which defines a single top-level type `Hello` which contains a single field, `greeting`, that takes a single, required argument `who`.
25+
26+
We can define this schema in Haskell and implement a simple handler like so:
1727

1828
```haskell
29+
{-# LANGUAGE OverloadedStrings #-}
30+
{-# LANGUAGE TypeApplications #-}
31+
{-# LANGUAGE TypeOperators #-}
32+
1933
import Data.Text (Text)
2034
import Data.Monoid ((<>))
2135

@@ -33,26 +47,42 @@ run :: Text -> IO Response
3347
run = interpretAnonymousQuery @Hello hello
3448
```
3549

36-
Note that we require GHC 8.0.2 or later for features like the `@Hello` type application, and for certain bug fixes.
50+
We require GHC 8.0.2 or later for features like the `@Hello` type application, and for certain bug fixes.
3751

3852
With the code above we can now run a query:
3953

4054
```haskell
4155
run "{ greeting(who: \"mort\") }"
4256
```
4357

44-
## Current status
58+
Which will produce the following GraphQL response:
59+
60+
```json
61+
{
62+
data: {
63+
greeting: "Hello mort"
64+
}
65+
}
66+
```
67+
68+
## Status
69+
70+
Our current goal is to gather feedback. We have learned a lot about GraphQL in the course of making this library, but we don't know what a good GraphQL library looks like in Haskell. Please [let us know](https://github.com/jml/graphql-api/issues/new) what you think. We won't mind if you file a bug telling us how good the library is.
4571

46-
This first release's goal is to gather feedback. We make **no** guarantees about API stability, or anything at all really.
72+
Because we're still learning, we make **no** guarantees about API stability, or anything at all really.
4773

48-
We are tracking open problem, missing features & wishlist-items in [GitHub's issue tracker](https://github.com/jml/graphql-api/issues).
74+
We are tracking open problems, missing features & wishlist items in [GitHub's issue tracker](https://github.com/jml/graphql-api/issues).
4975

5076
## Roadmap
5177

5278
* Near future:
53-
- Complete lose ends in current implementation & gather feedback.
79+
- Better error messages (this is really important to us)
80+
- Full support for recursive data types
81+
- Close off lose ends in current implementation & gather feedback
5482
* Medium future:
55-
- Implement introspection
83+
- Full schema validation
84+
- Schema introspection
85+
- Stabilize public API
5686
* Long term:
5787
- Derive client implementations from types
5888
- Allow users to implement their own type combinators

0 commit comments

Comments
 (0)