graphql (empty) → 0.1
raw patch · 7 files changed
+232/−0 lines, 7 filesdep +basedep +textsetup-changed
Dependencies added: base, text
Files
- CHANGELOG.md +6/−0
- Data/GraphQL.hs +140/−0
- LICENSE +30/−0
- README.md +22/−0
- Setup.hs +2/−0
- graphql.cabal +27/−0
- stack.yaml +5/−0
+ CHANGELOG.md view
@@ -0,0 +1,6 @@+# Change Log+All notable changes to this project will be documented in this file.++## [0.1] - 2015-09-12+### Added+- Data types for the GraphQL language.
+ Data/GraphQL.hs view
@@ -0,0 +1,140 @@+module Data.GraphQL where++import Data.Text (Text)++-- * Name++type Name = Text++-- * Document++newtype Document = Document [Definition] deriving (Eq,Show)++data Definition = DefinitionOperation OperationDefinition+ | DefinitionFragment FragmentDefinition+ | DefinitionType TypeDefinition+ deriving (Eq,Show)++data OperationDefinition =+ Query (Maybe [VariableDefinition]) (Maybe [Directive]) SelectionSet+ | Mutation (Maybe [VariableDefinition]) (Maybe [Directive]) SelectionSet+ | Subscription (Maybe [VariableDefinition]) (Maybe [Directive]) SelectionSet+ deriving (Eq,Show)++data VariableDefinition = VariableDefinition Variable Type (Maybe DefaultValue)+ deriving (Eq,Show)++newtype Variable = Variable Name deriving (Eq,Show)++newtype SelectionSet = SelectionSet [Selection] deriving (Eq,Show)++data Selection = SelectionField Field+ | SelectionFragmentSpread FragmentSpread+ | SelectionInlineFragment InlineFragment+ deriving (Eq,Show)++data Field = Field (Maybe Alias) Name (Maybe [Argument])+ (Maybe [Directive])+ (Maybe SelectionSet)+ deriving (Eq,Show)++type Alias = Name++data Argument = Argument Name Value deriving (Eq,Show)++-- * Fragments++data FragmentSpread = FragmentSpread Name (Maybe [Directive])+ deriving (Eq,Show)++data InlineFragment =+ InlineFragment TypeCondition (Maybe [Directive]) SelectionSet+ deriving (Eq,Show)++data FragmentDefinition =+ FragmentDefinition Name TypeCondition (Maybe [Directive]) SelectionSet+ deriving (Eq,Show)++type TypeCondition = NamedType++-- * Values++data Value = ValueVariable Variable+ | ValueInt Int+ | ValueFloat Float+ | ValueString Text+ | ValueBoolean Bool+ | ValueEnum Name+ | ValueList ListValue+ | ValueObject ObjectValue+ deriving (Eq,Show)++newtype ListValue = ListValue [Value] deriving (Eq,Show)++newtype ObjectValue = ObjectValue [ObjectField] deriving (Eq,Show)++data ObjectField = ObjectField Name Value deriving (Eq,Show)++type DefaultValue = Value++-- * Directives++data Directive = Directive Name (Maybe [Argument]) deriving (Eq,Show)++-- * Type Reference++data Type = TypeNamed NamedType+ | TypeList ListType+ | TypeNonNull NonNullType+ deriving (Eq,Show)++newtype NamedType = NamedType Name deriving (Eq,Show)++newtype ListType = ListType Type deriving (Eq,Show)++data NonNullType = NonNullTypeNamed NamedType+ | NonNullTypeList ListType+ deriving (Eq,Show)++-- * Type definition++data TypeDefinition = TypeDefinitionObject ObjectTypeDefinition+ | TypeDefinitionInterface InterfaceTypeDefinition+ | TypeDefinitionUnion UnionTypeDefinition+ | TypeDefinitionScalar ScalarTypeDefinition+ | TypeDefinitionEnum EnumTypeDefinition+ | TypeDefinitionInputObject InputObjectTypeDefinition+ | TypeDefinitionTypeExtension TypeExtensionDefinition+ deriving (Eq,Show)++data ObjectTypeDefinition = ObjectTypeDefinition Name (Maybe Interfaces) [FieldDefinition]+ deriving (Eq,Show)++type Interfaces = [NamedType]++data FieldDefinition = FieldDefinition Name [InputValueDefinition]+ deriving (Eq,Show)++data InputValueDefinition = InputValueDefinition Name Type (Maybe DefaultValue)+ deriving (Eq,Show)++data InterfaceTypeDefinition = InterfaceTypeDefinition Name [FieldDefinition]+ deriving (Eq,Show)++data UnionTypeDefinition = UnionTypeDefinition Name [NamedType]+ deriving (Eq,Show)++data ScalarTypeDefinition = ScalarTypeDefinition Name+ deriving (Eq,Show)++data EnumTypeDefinition = EnumTypeDefinition Name [EnumValueDefinition]+ deriving (Eq,Show)++newtype EnumValueDefinition = EnumValueDefinition Name+ deriving (Eq,Show)++data InputObjectTypeDefinition = InputObjectTypeDefinition Name [InputValueDefinition]+ deriving (Eq,Show)++newtype TypeExtensionDefinition = TypeExtensionDefinition ObjectTypeDefinition+ deriving (Eq,Show)
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright J. Daniel Navarro (c) 2015++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of J. Daniel Navarro nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,22 @@+# Haskell GraphQL++[](https://hackage.haskell.org/package/graphql)++For now this only provides the data types to represent the GraphQL AST,+but the idea is to be a Haskell port of+[`graphql-js`](https://github.com/graphql/graphql-js). Next releases+should include:++- [ ] Parser for the GraphQL language.+- [ ] Data types for the GraphQL Schema language.+- [ ] Parser for the GraphQL Schema language.+- [ ] Interpreter of GraphQL requests.+- [ ] Utilities to define GraphQL types and schema.++## Contact++Suggestions, contributions and bug reports are welcome.++Feel free to contact me, jdnavarro, on the #haskell channel on the+[GraphQL Slack Server](https://graphql.slack.com). You can obtain an+invitation [here](https://graphql-slack.herokuapp.com/).
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ graphql.cabal view
@@ -0,0 +1,27 @@+name: graphql+version: 0.1+synopsis: GraphQL Haskell implementation+description:+ For now this package provides the data types for the GraphQL language.+ Further releases will cover more aspects of the GraphQL specification.+homepage: https://github.com/jdnavarro/graphql-haskell+bug-reports: https://github.com/jdnavarro/graphql-haskell/issues+license: BSD3+license-file: LICENSE+author: Danny Navarro+maintainer: j@dannynavarro.net+copyright: Copyright (C) 2015 J. Daniel Navarro+category: Web+build-type: Simple+extra-source-files: README.md CHANGELOG.md stack.yaml+cabal-version: >=1.10++library+ exposed-modules: Data.GraphQL+ build-depends: base >= 4.7 && < 5,+ text >=0.11.3.1+ default-language: Haskell2010++source-repository head+ type: git+ location: git://github.com/jdnavarro/graphql-haskell.git
+ stack.yaml view
@@ -0,0 +1,5 @@+flags: {}+packages:+- '.'+extra-deps: []+resolver: lts-3.4