| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Data.Aeson.Schema.CodeGenM
Contents
- data Declaration
- type Code = [Declaration]
- newtype CodeGenM s a = CodeGenM {
- unCodeGenM :: RWST (Options, s) Code StringSet Q a
- renderDeclaration :: Declaration -> Text
- codeGenNewName :: String -> StringSet -> (Name, StringSet)
- genRecord :: Name -> [(Name, TypeQ, Maybe Text)] -> [Name] -> Q Declaration
- data Options = Options {
- _extraModules :: [String]
- _derivingTypeclasses :: [Name]
- _replaceModules :: Map String String
- _languageExtensions :: [Text]
- _ghcOptsPragmas :: [Text]
- _extraInstances :: Name -> [DecQ]
- defaultOptions :: Options
- askOpts :: CodeGenM s Options
- askEnv :: CodeGenM s s
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)
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
Customising the codegen
Extra options used for the codegen
Constructors
| Options | |
Fields
| |
Instances
| MonadReader (Options, s) (CodeGenM s) |