summaryrefslogtreecommitdiff
path: root/test/Rendering/Schema.hs
blob: d42a04340f6c7796e974f936c0f90a21d1f4afa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{-# LANGUAGE DeriveGeneric         #-}
{-# LANGUAGE DerivingStrategies    #-}
{-# LANGUAGE FlexibleContexts      #-}
{-# LANGUAGE FlexibleInstances     #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns        #-}
{-# LANGUAGE OverloadedStrings     #-}
{-# LANGUAGE ScopedTypeVariables   #-}
{-# LANGUAGE TemplateHaskell       #-}
{-# LANGUAGE TypeApplications      #-}
{-# LANGUAGE TypeFamilies          #-}

module Rendering.Schema
  ( schemaProxy
  ) where

import           Data.Morpheus.Document (importGQLDocumentWithNamespace)
import           Data.Morpheus.Kind     (SCALAR)
import           Data.Morpheus.Types    (GQLRootResolver (..), GQLScalar (..), GQLType (..), ID (..), IORes,
                                         ScalarValue (..))
import           Data.Proxy             (Proxy (..))
import           Data.Text              (Text)
import           GHC.Generics           (Generic)

data TestScalar =
  TestScalar
  deriving (Show, Generic)

instance GQLType TestScalar where
  type KIND TestScalar = SCALAR

instance GQLScalar TestScalar where
  parseValue _ = pure TestScalar
  serialize TestScalar = Int 0

importGQLDocumentWithNamespace "test/Rendering/schema.gql"

schemaProxy :: Proxy (GQLRootResolver IO () () (Query IORes) () ())
schemaProxy = Proxy @(GQLRootResolver IO () () (Query IORes) () ())