json-to-haskell-0.1.1.2
Safe HaskellNone
LanguageHaskell2010

JsonToHaskell.Internal.Printer

Synopsis

Documentation

data Env Source #

The environment used for printing the module

Constructors

Env 

toFieldName :: Text -> Text Source #

Convert a name into a valid haskell field name

parens :: MonadWriter Text m => m a -> m a Source #

Wrap a writer in parens

line :: (MonadReader Env m, MonadWriter Text m) => m a -> m a Source #

Embed the given writer at the correct level of indentation and add a newline

newline :: MonadWriter Text m => m () Source #

Add a newline

indented :: (MonadReader Env m, MonadWriter Text m) => m a -> m a Source #

Indent all lines of the given writer by one tabstop

writeRecord :: StructName -> RecordFields 'Ref -> Builder () Source #

Write out the Haskell code for a record data type

writeToJSONInstance :: StructName -> RecordFields 'Ref -> Builder () Source #

Write out the Haskell code for a ToJSON instance for the given record

writeFromJSONInstance :: StructName -> RecordFields 'Ref -> Builder () Source #

Write out the Haskell code for a FromJSON instance for the given record

writeType :: Bool -> Struct 'Ref -> Builder () Source #

Write out the Haskell representation for a given JSON type

writeModel :: Options -> Bimap Text (RecordFields 'Ref) -> Text Source #

Write out all the given records and their instances