morpheus-graphql-app: Morpheus GraphQL Core

[ graphql, library, mit, web ] [ Propose Tags ]

Build GraphQL APIs with your favourite functional language!


[Skip to Readme]
Versions [faq] 0.17.0
Change log changelog.md
Dependencies aeson (>=1.4.4.0 && <=1.6), base (>=4.7 && <5), bytestring (>=0.10.4 && <0.11), containers (>=0.4.2.1 && <0.7), hashable (>=1.0.0), megaparsec (>=7.0.0 && <10.0.0), morpheus-graphql-core (>=0.17.0 && <0.18.0), mtl (>=2.0 && <=3.0), relude (>=0.3.0), scientific (>=0.3.6.2 && <0.4), template-haskell (>=2.0 && <=3.0), text (>=1.2.3.0 && <1.3), th-lift-instances (>=0.1.1 && <=0.3), transformers (>=0.3.0.0 && <0.6), unordered-containers (>=0.2.8.0 && <0.3), vector (>=0.12.0.1 && <0.13) [details]
License MIT
Copyright (c) 2019 Daviti Nalchevanidze
Author Daviti Nalchevanidze
Maintainer d.nalchevanidze@gmail.com
Category web, graphql
Home page https://morpheusgraphql.com
Bug tracker https://github.com/nalchevanidze/morpheus-graphql-app/issues
Source repo head: git clone https://github.com/nalchevanidze/morpheus-graphql-app
Uploaded by nalchevanidze at 2021-02-25T13:45:16Z
Distributions NixOS:0.17.0
Downloads 45 total (11 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2021-02-25 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for morpheus-graphql-app-0.17.0

[back to package description]

Morpheus GraphQL App

provides utilities for creating executable GraphQL applications for servers. You can use it to create a schema-first GraphQL server with dynamic typings.

Build schema-first GraphQL App with dynamic typings

schema :: Schema VALID
schema =
  [dsl|
  type Query {
    deity(name: String): Deity!
  }

  type Deity {
    name: String!
    power: [String!]!
  }
|]

resolver :: Monad m => RootResolverValue e m
resolver =
  RootResModel
    { query =
        pure $
          mkObject
            "Query"
            [("deity", resolveDeity)],
      mutation = pure mkNull,
      subscription = pure mkNull
    }

resolveDeity :: Monad m => m (ResolverValue  m)
resolveDeity =
  pure $
    mkObject
      "Deity"
      [ ("name", pure $ mkString "Morpheus"),
        ("power", pure $ mkList [mkString "Shapeshifting"])
      ]

api :: ByteString -> IO  ByteString
api = runApp (mkApp schema resolver)