Skip to content

Scalar Type

nalchevanidze edited this page May 16, 2019 · 2 revisions

Scalar types

To use custom scalar types, you need to provide implementations for parseValue and serialize respectively and associate them with ENUM type.

type instance KIND Euro = SCALAR

data Euro = Euro Int Int deriving (Generic, GQLType)

instance GQLScalar Odd where
  parseValue (Int x) = pure $ Euro (...  )
  parseValue (String x) = pure $ Euro (...  )
  serialize  (Euro euro cent) = Int (euro * 100) ++ cent
Clone this wiki locally