packages feed

graphql-spice 1.0.4.0 → 1.0.5.0

raw patch · 3 files changed

+25/−2 lines, 3 filesdep ~graphqlPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: graphql

API changes (from Hackage documentation)

+ Language.GraphQL.Class: instance Language.GraphQL.Class.FromGraphQL Language.GraphQL.Type.Definition.Value
+ Language.GraphQL.Class: instance Language.GraphQL.Class.FromGraphQL a => Language.GraphQL.Class.FromGraphQL (Data.HashMap.Internal.HashMap Data.Text.Internal.Text a)
+ Language.GraphQL.Class: instance Language.GraphQL.Class.ToGraphQL Language.GraphQL.Type.Definition.Value
+ Language.GraphQL.Class: instance Language.GraphQL.Class.ToGraphQL a => Language.GraphQL.Class.ToGraphQL (Data.HashMap.Internal.HashMap Data.Text.Internal.Text a)

Files

CHANGELOG.md view
@@ -6,6 +6,10 @@ and this project adheres to [Haskell Package Versioning Policy](https://pvp.haskell.org/). +## [1.0.5.0] - 2024-11-21+### Added+- Add `ToGraphQL` and `FromGraphQL` instances for `Value` and `HashMap`.+ ## [1.0.4.0] - 2024-10-24 ### Added - `gql` quasi quoter which generates a string literal with the first line@@ -37,6 +41,7 @@ - JSON serialization. - Test helpers. +[1.0.5.0]: https://git.caraus.tech/OSS/graphql-spice/compare/v1.0.4.0...v1.0.5.0 [1.0.4.0]: https://git.caraus.tech/OSS/graphql-spice/compare/v1.0.3.0...v1.0.4.0 [1.0.3.0]: https://git.caraus.tech/OSS/graphql-spice/compare/v1.0.2.0...v1.0.3.0 [1.0.2.0]: https://git.caraus.tech/OSS/graphql-spice/compare/v1.0.1.0...v1.0.2.0
graphql-spice.cabal view
@@ -1,7 +1,7 @@ cabal-version:      3.0  name:               graphql-spice-version:            1.0.4.0+version:            1.0.5.0 synopsis:           GraphQL with batteries description:        Various extensions and convenience functions for the core                     graphql package.@@ -38,7 +38,7 @@       containers >= 0.6 && < 0.8,       exceptions ^>= 0.10.4,       hspec-expectations >= 0.8.2 && < 0.9,-      graphql ^>= 1.3.0,+      graphql >= 1.3.0 && < 1.5.0,       megaparsec >= 9.0 && < 10,       scientific ^>= 0.3.7,       template-haskell >= 2.16 && < 3,
src/Language/GraphQL/Class.hs view
@@ -5,6 +5,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TupleSections #-}+{-# LANGUAGE FlexibleInstances #-}  -- | ToGraphQL and FromGraphQL typeclasses used for user-defined type -- conversion.@@ -101,6 +102,10 @@   where     toGraphQL :: a -> Type.Value +instance ToGraphQL Type.Value+  where+    toGraphQL a = a+ instance ToGraphQL Text   where     toGraphQL = Type.String@@ -198,12 +203,20 @@   where     toGraphQL = iso8601ToGraphQL +instance ToGraphQL a => ToGraphQL (HashMap.HashMap Text a)+  where+    toGraphQL = Type.Object . fmap toGraphQL+ -- | Instances of this typeclass can be used to convert GraphQL internal -- representation to user-defined type. class FromGraphQL a   where     fromGraphQL :: Type.Value -> Maybe a +instance FromGraphQL Type.Value+  where+    fromGraphQL = Just+ instance FromGraphQL Text   where     fromGraphQL (Type.String value) = Just value@@ -310,6 +323,11 @@ instance FromGraphQL LocalTime   where     fromGraphQL = fromGraphQLToISO8601++instance FromGraphQL a => FromGraphQL (HashMap.HashMap Text a)+  where+    fromGraphQL (Type.Object hm) = traverse fromGraphQL hm+    fromGraphQL _ = Nothing  stringLE :: Name -> Q Exp stringLE = litE . stringL . nameBase