forked from OSS/graphql
Add show instances for AST type representation
This commit is contained in:
parent
2bcae9e0a7
commit
5a6709030c
@ -14,6 +14,7 @@ and this project adheres to
|
|||||||
- `Type.Schema.implementations` contains a map from interfaces and objects to
|
- `Type.Schema.implementations` contains a map from interfaces and objects to
|
||||||
interfaces they implement.
|
interfaces they implement.
|
||||||
- Show instances for GraphQL type definitions in the `Type` modules.
|
- Show instances for GraphQL type definitions in the `Type` modules.
|
||||||
|
- Custom Show instances for the type representation in the AST.
|
||||||
|
|
||||||
## [0.11.0.0] - 2020-11-07
|
## [0.11.0.0] - 2020-11-07
|
||||||
### Changed
|
### Changed
|
||||||
|
@ -281,7 +281,12 @@ data Type
|
|||||||
= TypeNamed Name
|
= TypeNamed Name
|
||||||
| TypeList Type
|
| TypeList Type
|
||||||
| TypeNonNull NonNullType
|
| TypeNonNull NonNullType
|
||||||
deriving (Eq, Show)
|
deriving Eq
|
||||||
|
|
||||||
|
instance Show Type where
|
||||||
|
show (TypeNamed typeName) = Text.unpack typeName
|
||||||
|
show (TypeList listType) = concat ["[", show listType, "]"]
|
||||||
|
show (TypeNonNull nonNullType) = show nonNullType
|
||||||
|
|
||||||
-- | Represents type names.
|
-- | Represents type names.
|
||||||
type NamedType = Name
|
type NamedType = Name
|
||||||
@ -290,7 +295,11 @@ type NamedType = Name
|
|||||||
data NonNullType
|
data NonNullType
|
||||||
= NonNullTypeNamed Name
|
= NonNullTypeNamed Name
|
||||||
| NonNullTypeList Type
|
| NonNullTypeList Type
|
||||||
deriving (Eq, Show)
|
deriving Eq
|
||||||
|
|
||||||
|
instance Show NonNullType where
|
||||||
|
show (NonNullTypeNamed typeName) = '!' : Text.unpack typeName
|
||||||
|
show (NonNullTypeList listType) = concat ["![", show listType, "]"]
|
||||||
|
|
||||||
-- ** Directives
|
-- ** Directives
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user