Safe Haskell | None |
---|---|
Language | Haskell98 |
Synopsis
- 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.
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
Eq Declaration Source # | |
Defined in Data.Aeson.Schema.CodeGenM (==) :: Declaration -> Declaration -> Bool # (/=) :: Declaration -> Declaration -> Bool # | |
Data Declaration Source # | |
Defined in Data.Aeson.Schema.CodeGenM gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Declaration -> c Declaration # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Declaration # toConstr :: Declaration -> Constr # dataTypeOf :: Declaration -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Declaration) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Declaration) # gmapT :: (forall b. Data b => b -> b) -> Declaration -> Declaration # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Declaration -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Declaration -> r # gmapQ :: (forall d. Data d => d -> u) -> Declaration -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Declaration -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Declaration -> m Declaration # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Declaration -> m Declaration # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Declaration -> m Declaration # | |
Show Declaration Source # | |
Defined in Data.Aeson.Schema.CodeGenM showsPrec :: Int -> Declaration -> ShowS # show :: Declaration -> String # showList :: [Declaration] -> ShowS # | |
MonadWriter Code (CodeGenM s) Source # | |
type Code = [Declaration] Source #
Haskell code (without module declaration and imports)
Instances
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
Options | |
|