Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Formatting type declarations and class instances for inferred types.
Synopsis
- displaySplitTypes :: Map Text Type -> Text
- normalizeTypeName :: Text -> Text
- normalizeFieldName :: Text -> Text -> Text
- formatType :: Type -> DeclM Text
Documentation
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.