git.iko.soy/rowtype-yoga/purescript-graphql-fundeps
on main help sign in
Updates naming conventions
commitde088099adf50cac8cda67861fb655ba7a28af8e authorMike Solomon <mike@meeshkan.com> dateMon 19 Jun 2023, 14:54 (3 years ago) parent018f8c7
3 files changed+28−4
spago.dhall+3 src/GraphQL.purs+22−2 test/Main.purs+3−2
spago.dhall+3
@@ -17,13 +17,16 @@ to generate this file without the comments in this block.
1717 , "console"
1818 , "effect"
1919 , "either"
20+ , "foreign"
2021 , "http-methods"
22+ , "lists"
2123 , "maybe"
2224 , "media-types"
2325 , "prelude"
2426 , "psci-support"
2527 , "simple-json"
2628 , "strings"
29+ , "transformers"
2730 ]
2831, packages = ./packages.dhall
2932, sources = [ "src/**/*.purs" ]
src/GraphQL.purs+22−2
@@ -50,7 +50,7 @@ type ParsingErrorInfo =
5050 , jsonParsingError :: NonEmptyList ForeignError
5151 }
5252
53−type GraphQLClient'
53+type GraphQLClient''
5454 (operation :: GraphQL)
5555 (gql :: Symbol)
5656 (i :: Row Type)
@@ -72,7 +72,27 @@ type GraphQLClient'
7272type GraphQLClient =
7373 forall (operation :: GraphQL)
7474 (gql :: Symbol) (i :: Row Type) (o :: Row Type) (m :: Type -> Type) (e :: Type)
75− . GraphQLClient' operation gql i o m e
75+ . GraphQLReqRes operation gql i o
76+ => IsSymbol gql
77+ => JSON.WriteForeign { | i }
78+ => JSON.ReadForeign { | o }
79+ => MonadAff m
80+ => MonadThrow e m
81+ => (NetworkErrorInfo -> e)
82+ -> (ParsingErrorInfo -> e)
83+ -> Gql operation
84+ -> Record i
85+ -> m { | o }
86+
87+type GraphQLClientAff =
88+ forall (operation :: GraphQL) (gql :: Symbol) (i :: Row Type) (o :: Row Type)
89+ . GraphQLReqRes operation gql i o
90+ => IsSymbol gql
91+ => JSON.WriteForeign { | i }
92+ => JSON.ReadForeign { | o }
93+ => Gql operation
94+ -> Record i
95+ -> Aff { | o }
7696
7797graphQL
7898 :: Endpoint
test/Main.purs+3−2
@@ -1,12 +1,13 @@
11module Test.Main where
22
33import Prelude
4+
45import Data.Foldable (for_)
56import Data.Maybe (Maybe(..))
67import Effect (Effect)
78import Effect.Aff (Milliseconds(..), launchAff_)
89import Effect.Class.Console as Log
9−import GraphQL.FunDeps (class GraphQLReqRes, Gql(..), GraphQL, GraphQLClient, graphQL)
10+import GraphQL.FunDeps (class GraphQLReqRes, Gql(..), GraphQL, GraphQLClientAff, graphQL)
1011import Test.Spec (describe, it)
1112import Test.Spec.Reporter.Console (consoleReporter)
1213import Test.Spec.Runner (defaultConfig, runSpec')
@@ -48,7 +49,7 @@ instance graphqlReactFinlandConference ::
4849 }
4950 )
5051
51−client :: GraphQLClient
52+client :: GraphQLClientAff
5253client = graphQL "https://api.react-finland.fi/graphql" []
5354
5455main ∷ Effect Unit