Reuse common types from AST.Core

This commit is contained in:
2019-07-18 05:10:02 +02:00
parent 74801b0483
commit bc6a7dddd1
5 changed files with 26 additions and 53 deletions

View File

@ -1,6 +1,7 @@
-- | This is the AST meant to be executed.
module Language.GraphQL.AST.Core
( Argument(..)
( Alias
, Argument(..)
, Document
, Field(..)
, Name
@ -15,6 +16,7 @@ import Data.String
import Data.Text (Text)
-- | Name
type Name = Text
type Document = NonEmpty Operation

View File

@ -10,16 +10,13 @@ import Data.Either (partitionEithers)
import Data.Foldable (fold, foldMap)
import qualified Data.List.NonEmpty as NonEmpty
import Data.Monoid (Alt(Alt,getAlt), (<>))
import Data.Text (Text)
import qualified Language.GraphQL.AST as Full
import qualified Language.GraphQL.AST.Core as Core
import qualified Language.GraphQL.Schema as Schema
type Name = Text
-- | Replaces a fragment name by a list of 'Field'. If the name doesn't match an
-- empty list is returned.
type Fragmenter = Name -> [Core.Field]
type Fragmenter = Core.Name -> [Core.Field]
-- TODO: Replace Maybe by MonadThrow with CustomError
document :: Schema.Subs -> Full.Document -> Maybe Core.Document