Skip to content

Latest commit

 

History

History
63 lines (39 loc) · 1.31 KB

File metadata and controls

63 lines (39 loc) · 1.31 KB

Module Data.Foreign.Generic

defaultOptions

defaultOptions :: Options

Default decoding/encoding options:

  • Represent sum types as records with tag and contents fields
  • Unwrap single arguments
  • Don't unwrap single constructors

genericDecode

genericDecode :: forall a rep. Generic a rep => GenericDecode rep => Options -> Foreign -> F a

Read a value which has a Generic type.

genericEncode

genericEncode :: forall a rep. Generic a rep => GenericEncode rep => Options -> a -> Foreign

Generate a Foreign value compatible with the readGeneric function.

decodeJSON

decodeJSON :: forall a. Decode a => String -> F a

Decode a JSON string using a Decode instance.

encodeJSON

encodeJSON :: forall a. Encode a => a -> String

Encode value that has an Encode instance into a JSON string.

genericDecodeJSON

genericDecodeJSON :: forall a rep. Generic a rep => GenericDecode rep => Options -> String -> F a

Read a value which has a Generic type from a JSON String

genericEncodeJSON

genericEncodeJSON :: forall a rep. Generic a rep => GenericEncode rep => Options -> a -> String

Write a value which has a Generic type as a JSON String