json-to-type-4.0.0: Automatic type declaration for JSON input data
Safe HaskellSafe-Inferred
LanguageHaskell2010

JsonToType.CodeGen.HaskellFormat

Description

Formatting type declarations and class instances for inferred types.

Synopsis

Documentation

displaySplitTypes :: Map Text Type -> Text Source #

Display an environment of types split by name.

normalizeTypeName :: Text -> Text Source #

Normalize type name by: 1. Treating all characters that are not acceptable in Haskell variable name as end of word. 2. Capitalizing each word, but a first (camelCase). 3. Adding underscore if first character is non-alphabetic. 4. Escaping Haskell keywords if the whole identifier is such keyword. 5. If identifier is empty, then substituting JsonEmptyKey for its name.

normalizeFieldName :: Text -> Text -> Text Source #

Convert a JSON key name given by second argument, from within a dictionary keyed with first argument, into a name of Haskell record field (hopefully distinct from other such selectors.)

formatType :: Type -> DeclM Text Source #

Format the type within DeclM monad, that records the separate declarations on which this one is dependent.