graphql-api-0.4.0: GraphQL API

Safe HaskellNone
LanguageHaskell2010

GraphQL.Internal.Value.FromValue

Description

 
Synopsis

Documentation

class FromValue a where Source #

a can be converted from a GraphQL Value to a Haskell value.

The FromValue instance converts Value to the type expected by the handler function. It is the boundary between incoming data and your custom application Haskell types.

FromValue has a generic instance for converting input objects to records.

Minimal complete definition

Nothing

Methods

fromValue :: Value' ConstScalar -> Either Text a Source #

Convert an already-parsed value into a Haskell value, generally to be passed to a handler.

fromValue :: (Generic a, GenericFromValue (Rep a)) => Value' ConstScalar -> Either Text a Source #

Convert an already-parsed value into a Haskell value, generally to be passed to a handler.

prop_roundtripValue :: forall a. (Eq a, ToValue a, FromValue a) => a -> Bool Source #

Anything that can be converted to a value and from a value should roundtrip.

wrongType :: (MonadError Text m, Show a) => Text -> a -> m b Source #

Throw an error saying that value does not have the expected type.