Safe Haskell | None |
---|---|
Language | Haskell98 |
Data.Aeson.Schema.CodeGenM
- data Declaration
- type Code = [Declaration]
- newtype CodeGenM s a = CodeGenM {
- unCodeGenM :: RWST s Code StringSet Q a
- renderDeclaration :: Declaration -> Text
- codeGenNewName :: String -> StringSet -> (Name, StringSet)
- genRecord :: Name -> [(Name, TypeQ, Maybe Text)] -> [Name] -> Q Declaration
Documentation
data Declaration Source
A top-level declaration.
Constructors
Declaration Dec (Maybe Text) | Optional textual declaration. This can be used for information (e.g. inline comments) that are not representable in TH. |
Comment Text | Comment text |
Instances
type Code = [Declaration] Source
Haskell code (without module declaration and imports)
Constructors
CodeGenM | |
Fields
|
Instances
MonadReader s (CodeGenM s) | |
MonadWriter Code (CodeGenM s) | |
Monad (CodeGenM s) | |
Functor (CodeGenM s) | |
Applicative (CodeGenM s) | |
MonadIO (CodeGenM s) | Generates a record data declaration where the fields may have descriptions for Haddock |
Quasi (CodeGenM s) |
renderDeclaration :: Declaration -> Text Source
Render a declaration. When a declaration contains both a TH syntax tree and a text representation, the text representation is preferred.
codeGenNewName :: String -> StringSet -> (Name, StringSet) Source
Generates a fresh name