fay-0.24.0.2: A compiler for Fay, a Haskell subset that compiles to JavaScript.

Safe HaskellNone
LanguageHaskell98

Fay.Convert

Description

Convert a Haskell value to a (JSON representation of a) Fay value.

Synopsis

Documentation

showToFay :: Data a => a -> Maybe Value Source #

Convert a Haskell value to a Fay json value. This can fail when primitive values aren't handled by explicit cases. encodeFay can be used to resolve this issue.

readFromFay :: Data a => Value -> Maybe a Source #

Convert a Fay json value to a Haskell value.

readFromFay' :: Data a => Value -> Either String a Source #

Convert a Fay json value to a Haskell value. This is like readFromFay, except it yields helpful error messages on failure.

encodeFay :: (GenericQ Value -> GenericQ Value) -> GenericQ Value Source #

Convert a Haskell value to a Fay json value. This can fail when primitive values aren't handled by explicit cases. When this happens, you can add additional cases via the first parameter.

The first parameter is a function that can be used to override the conversion. This usually looks like using extQ to additional type- specific cases.

decodeFay :: Data b => (forall a. Data a => Value -> Either String a -> Either String a) -> Value -> Either String b Source #

Convert a Fay json value to a Haskell value.

The first parameter is a function that can be used to override the conversion. This usually looks like using extR to additional type- specific cases.