fortran-src-extras-0.4.0: Common functions and utils for fortran-src.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Fortran.Extras.JSON.Helpers

Description

Helpers for defining Aeson instances for fortran-src types.

To work around dependency awkwardness, we have to write an unusual concrete context ToJSON SrcSpan. It seems to work fine.

Synopsis

Documentation

toJSONAnnoMerge :: (ToJSON a, ToJSON SrcSpan) => Text -> a -> SrcSpan -> [Pair] -> Value Source #

Shortcut for writing a toJSON definition for a fortran-src AST node type, intended to be used for sum types.

Flat/concise version which merges all keys into the same object.

toJSONAnnoTaggedObj :: (ToJSON a, ToJSON SrcSpan) => Text -> a -> SrcSpan -> [Pair] -> Value Source #

Shortcut for writing a toJSON definition for a fortran-src AST node type, intended to be used for sum types.

Safe version which approximates Aeson's default TaggedObject sum encoding strategy, but with two extra fields extracted out.

jcProd :: (String -> String) -> Options Source #

Base Aeson generic deriver config for product types.

jcSum :: (String -> String) -> String -> String -> Options Source #

Base Aeson generic deriver config for sum types.

jcEnum :: (String -> String) -> Options Source #

Base Aeson generic deriver config for enum types (no fields in any cons).

tja :: (ToJSON a, ToJSON SrcSpan) => Text -> a -> SrcSpan -> [Pair] -> Value Source #

Shortcut for selected fortran-src AST node type toJSON strategy.

gtj :: (Generic a, GToJSON' Value Zero (Rep a)) => Options -> a -> Value Source #

Shortcut for common function genericToJSON

gte :: (Generic a, GToJSON' Encoding Zero (Rep a)) => Options -> a -> Encoding Source #

Shortcut for common function genericToEncoding