Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Env = Env {}
- options :: Lens' Env Options
- indentationLevel :: Lens' Env Int
- toFieldName :: Text -> Text
- type StructName = Text
- parens :: MonadWriter Text m => m a -> m a
- line :: (MonadReader Env m, MonadWriter Text m) => m a -> m a
- newline :: MonadWriter Text m => m ()
- indented :: (MonadReader Env m, MonadWriter Text m) => m a -> m a
- type Builder a = ReaderT Env (Writer Text) ()
- writeFieldName :: Text -> Text -> Builder ()
- writeRecord :: StructName -> RecordFields 'Ref -> Builder ()
- writeToJSONInstance :: StructName -> RecordFields 'Ref -> Builder ()
- writeFromJSONInstance :: StructName -> RecordFields 'Ref -> Builder ()
- writeType :: Bool -> Struct 'Ref -> Builder ()
- writeModel :: Options -> Bimap Text (RecordFields 'Ref) -> Text
- escapeQuotes :: Text -> Text
Documentation
The environment used for printing the module
Env | |
|
toFieldName :: Text -> Text Source #
Convert a name into a valid haskell field name
type StructName = Text Source #
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 line
s 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
escapeQuotes :: Text -> Text Source #