forked from OSS/graphql-spice
Add ToGraphQL and romGraphQL
instances for Word
This commit is contained in:
parent
5306730ff8
commit
7c146fe416
@ -6,6 +6,10 @@ The format is based on
|
|||||||
and this project adheres to
|
and this project adheres to
|
||||||
[Haskell Package Versioning Policy](https://pvp.haskell.org/).
|
[Haskell Package Versioning Policy](https://pvp.haskell.org/).
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
- `ToGraphQL` and `FromGraphQL` instances for `Word`.
|
||||||
|
|
||||||
## [1.0.1.0] - 2023-02-17
|
## [1.0.1.0] - 2023-02-17
|
||||||
### Added
|
### Added
|
||||||
- `ToGraphQL` and `FromGraphQL` typeclasses with instances for basic types.
|
- `ToGraphQL` and `FromGraphQL` typeclasses with instances for basic types.
|
||||||
@ -16,4 +20,5 @@ and this project adheres to
|
|||||||
- JSON serialization.
|
- JSON serialization.
|
||||||
- Test helpers.
|
- Test helpers.
|
||||||
|
|
||||||
|
[Unreleased]: https://www.caraus.tech/projects/pub-graphql-spice/repository/28/diff?rev=master&rev_to=v1.0.1.0
|
||||||
[1.0.1.0]: https://www.caraus.tech/projects/pub-graphql-spice/repository/28/diff?rev=v1.0.1.0&rev_to=v1.0.0.0
|
[1.0.1.0]: https://www.caraus.tech/projects/pub-graphql-spice/repository/28/diff?rev=v1.0.1.0&rev_to=v1.0.0.0
|
||||||
|
@ -14,6 +14,7 @@ module Language.GraphQL.Class
|
|||||||
import Data.Foldable (toList)
|
import Data.Foldable (toList)
|
||||||
import Data.Int (Int8, Int16, Int32, Int64)
|
import Data.Int (Int8, Int16, Int32, Int64)
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
|
import Data.Word (Word8, Word16, Word32, Word64)
|
||||||
import qualified Data.Text.Read as Text.Read
|
import qualified Data.Text.Read as Text.Read
|
||||||
import Data.Vector (Vector)
|
import Data.Vector (Vector)
|
||||||
import qualified Data.Vector as Vector
|
import qualified Data.Vector as Vector
|
||||||
@ -50,6 +51,21 @@ instance ToGraphQL Int32 where
|
|||||||
instance ToGraphQL Int64 where
|
instance ToGraphQL Int64 where
|
||||||
toGraphQL = Type.Int . fromIntegral
|
toGraphQL = Type.Int . fromIntegral
|
||||||
|
|
||||||
|
instance ToGraphQL Word where
|
||||||
|
toGraphQL = Type.Int . fromIntegral
|
||||||
|
|
||||||
|
instance ToGraphQL Word8 where
|
||||||
|
toGraphQL = Type.Int . fromIntegral
|
||||||
|
|
||||||
|
instance ToGraphQL Word16 where
|
||||||
|
toGraphQL = Type.Int . fromIntegral
|
||||||
|
|
||||||
|
instance ToGraphQL Word32 where
|
||||||
|
toGraphQL = Type.Int . fromIntegral
|
||||||
|
|
||||||
|
instance ToGraphQL Word64 where
|
||||||
|
toGraphQL = Type.Int . fromIntegral
|
||||||
|
|
||||||
instance ToGraphQL a => ToGraphQL [a] where
|
instance ToGraphQL a => ToGraphQL [a] where
|
||||||
toGraphQL = Type.List . fmap toGraphQL
|
toGraphQL = Type.List . fmap toGraphQL
|
||||||
|
|
||||||
@ -87,6 +103,21 @@ instance FromGraphQL Int32 where
|
|||||||
instance FromGraphQL Int64 where
|
instance FromGraphQL Int64 where
|
||||||
fromGraphQL = fromGraphQLToIntegral
|
fromGraphQL = fromGraphQLToIntegral
|
||||||
|
|
||||||
|
instance FromGraphQL Word where
|
||||||
|
fromGraphQL = fromGraphQLToIntegral
|
||||||
|
|
||||||
|
instance FromGraphQL Word8 where
|
||||||
|
fromGraphQL = fromGraphQLToIntegral
|
||||||
|
|
||||||
|
instance FromGraphQL Word16 where
|
||||||
|
fromGraphQL = fromGraphQLToIntegral
|
||||||
|
|
||||||
|
instance FromGraphQL Word32 where
|
||||||
|
fromGraphQL = fromGraphQLToIntegral
|
||||||
|
|
||||||
|
instance FromGraphQL Word64 where
|
||||||
|
fromGraphQL = fromGraphQLToIntegral
|
||||||
|
|
||||||
instance FromGraphQL a => FromGraphQL [a] where
|
instance FromGraphQL a => FromGraphQL [a] where
|
||||||
fromGraphQL (Type.List value) = traverse fromGraphQL value
|
fromGraphQL (Type.List value) = traverse fromGraphQL value
|
||||||
fromGraphQL _ = Nothing
|
fromGraphQL _ = Nothing
|
||||||
|
Loading…
Reference in New Issue
Block a user