Skip to content

Add Morpheus GraphQL to the list of GraphQL libraries #890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions src/content/code/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ In addition to the GraphQL [reference implementations in JavaScript](#javascript
- [Erlang](#erlang)
- [Go](#go)
- [Groovy](#groovy)
- [Haskell](#haskell)
- [Java](#java)
- [JavaScript](#javascript)
- [Julia](#julia)
Expand Down Expand Up @@ -170,6 +171,74 @@ See [the documentation](https://grails.github.io/gorm-graphql/latest/guide/index

GQL is a Groovy library for GraphQL

### Haskell

#### [Morpheus GraphQL](https://github.com/morpheusgraphql/morpheus-graphql)

A Haskell library for building GraphQL APIs.

Hello world example with `morpheus-graphql`:

```graphql
# schema.gql
"""
A supernatural being considered divine and sacred
"""
type Deity {
name: String!
power: String @deprecated(reason: "no more supported")
}

type Query {
deity(name: String! = "Morpheus"): Deity!
}
```


```haskell
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}

module API (api) where

import Data.ByteString.Lazy.Char8 (ByteString)
import Data.Morpheus (interpreter)
import Data.Morpheus.Document (importGQLDocument)
import Data.Morpheus.Types (RootResolver (..), Undefined (..))
import Data.Text (Text)

importGQLDocument "schema.gql"

rootResolver :: RootResolver IO () Query Undefined Undefined
rootResolver =
RootResolver
{ queryResolver = Query {deity},
mutationResolver = Undefined,
subscriptionResolver = Undefined
}
where
deity DeityArgs {name} =
pure
Deity
{ name = pure name,
power = pure (Just "Shapeshifting")
}

api :: ByteString -> IO ByteString
api = interpreter rootResolver
```

See [morpheus-graphql-examples](https://github.com/morpheusgraphql/morpheus-graphql) for more sophisticated APIs.


### Java

#### [graphql-java](https://github.com/graphql-java/graphql-java)
Expand Down Expand Up @@ -597,6 +666,7 @@ Executor.execute(schema, query) map println
- [Elm](#elm)
- [Flutter](#flutter)
- [Go](#go-1)
- [Haskell](#haskell)
- [Java / Android](#java-android)
- [JavaScript](#javascript-1)
- [Julia](#julia)
Expand Down Expand Up @@ -628,6 +698,10 @@ Executor.execute(schema, query) map println
- [graphql](https://github.com/shurcooL/graphql#readme): A GraphQL client implementation in Go.
- [machinebox/graphql](https://github.com/machinebox/graphql): An elegant low-level HTTP client for GraphQL.

### Haskell

- [morpheus-graphql-client](https://github.com/morpheusgraphql/morpheus-graphql): A strongly-typed GraphQL client implementation in Haksell.

### Java / Android

- [Apollo Android](https://github.com/apollographql/apollo-android): A strongly-typed, caching GraphQL client for the JVM, Android and Kotlin native.
Expand Down