mirror of
https://github.com/higherkindness/mu-haskell.git
synced 2024-10-26 15:49:00 +03:00
97 lines
2.5 KiB
Plaintext
97 lines
2.5 KiB
Plaintext
{-# START_FILE {{name}}.cabal #-}
|
||
name: {{name}}
|
||
version: 0.1.0.0
|
||
|
||
-- synopsis:
|
||
-- description:
|
||
homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme
|
||
author: {{author-name}}{{^author-name}}Author name here{{/author-name}}
|
||
maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}}
|
||
copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2020{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}}
|
||
category: {{category}}{{^category}}Web{{/category}}
|
||
build-type: Simple
|
||
cabal-version: >=1.10
|
||
extra-source-files: README.md
|
||
|
||
executable {{name}}
|
||
hs-source-dirs: src
|
||
main-is: Main.hs
|
||
ghc-options: -Wall
|
||
default-language: Haskell2010
|
||
build-depends:
|
||
base >=4.12 && <5
|
||
, conduit
|
||
, mu-graphql >=0.4.1
|
||
, mu-rpc >=0.4.0
|
||
, mu-schema >=0.3.1
|
||
, text
|
||
, wai-extra
|
||
, warp
|
||
|
||
|
||
{-# START_FILE stack.yaml #-}
|
||
resolver: lts-16.22
|
||
allow-newer: true
|
||
extra-deps:
|
||
- mu-schema-0.3.1.1
|
||
- mu-rpc-0.4.0.1
|
||
- mu-graphql-0.4.1.0
|
||
- graphql-0.11.0.0
|
||
- primitive-extras-0.8
|
||
- primitive-unlifted-0.1.3.0
|
||
- stm-hamt-1.2.0.4
|
||
- stm-containers-1.1.0.4
|
||
- stm-lifted-2.5.0.0
|
||
|
||
{-# START_FILE Setup.hs #-}
|
||
import Distribution.Simple
|
||
main = defaultMain
|
||
|
||
{-# START_FILE .gitignore #-}
|
||
.stack-work/
|
||
stack*.yaml.lock
|
||
*~
|
||
|
||
{-# START_FILE README.md #-}
|
||
# {{name}}
|
||
|
||
{-# START_FILE schema.graphql #-}
|
||
type Query {
|
||
hello: String
|
||
}
|
||
|
||
{-# START_FILE src/Main.hs #-}
|
||
{-# language DataKinds #-}
|
||
{-# language FlexibleContexts #-}
|
||
{-# language OverloadedStrings #-}
|
||
{-# language PartialTypeSignatures #-}
|
||
{-# language PolyKinds #-}
|
||
{-# language ScopedTypeVariables #-}
|
||
{-# language TemplateHaskell #-}
|
||
{-# language TypeApplications #-}
|
||
{-# language TypeFamilies #-}
|
||
{-# language TypeOperators #-}
|
||
{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-}
|
||
|
||
module Main where
|
||
|
||
import Data.Proxy
|
||
|
||
import Mu.GraphQL.Quasi
|
||
import Mu.GraphQL.Server
|
||
import Mu.Server
|
||
|
||
graphql "ServiceDefinition" "schema.graphql"
|
||
|
||
-- GraphQL App
|
||
|
||
main :: IO ()
|
||
main = do
|
||
putStrLn "starting GraphQL server on port 8080"
|
||
runGraphQLAppQuery 8080 server (Proxy @"Query")
|
||
|
||
type ServiceMapping = '[]
|
||
|
||
server :: MonadServer m => ServerT ServiceMapping i ServiceDefinition m _
|
||
server = resolver ( object @"Query" ( method @"hello" $ error "not implemented" ) )
|