Safe Haskell | None |
---|
- data Tool a
- type APITool = Tool API
- type APINodeTool = Tool APINode
- runTool :: Tool a -> ToolSettings -> a -> Q [Dec]
- simpleTool :: (a -> Q [Dec]) -> Tool a
- mkTool :: (ToolSettings -> a -> Q [Dec]) -> Tool a
- contramapTool :: (a -> b) -> Tool b -> Tool a
- readTool :: (a -> Tool a) -> Tool a
- subTools :: Tool a -> Tool [a]
- apiNodeTool :: Tool APINode -> Tool API
- apiDataTypeTool :: Tool APINode -> Tool API
- apiSpecTool :: Tool (APINode, SpecNewtype) -> Tool (APINode, SpecRecord) -> Tool (APINode, SpecUnion) -> Tool (APINode, SpecEnum) -> Tool (APINode, APIType) -> Tool APINode
- data ToolSettings
- warnOnOmittedInstance :: ToolSettings -> Bool
- defaultToolSettings :: ToolSettings
Documentation
type APINodeTool = Tool APINodeSource
runTool :: Tool a -> ToolSettings -> a -> Q [Dec]Source
Execute a tool to generate some TH declarations.
Smart constructors and combinators
simpleTool :: (a -> Q [Dec]) -> Tool aSource
Construct a tool that does not depend on any settings
mkTool :: (ToolSettings -> a -> Q [Dec]) -> Tool aSource
Construct a tool that may depend on the settings
contramapTool :: (a -> b) -> Tool b -> Tool aSource
Tool
is a contravariant functor
apiDataTypeTool :: Tool APINode -> Tool APISource
Apply a tool that acts on datatype nodes (i.e. those that are not synonyms) to an entire API
apiSpecTool :: Tool (APINode, SpecNewtype) -> Tool (APINode, SpecRecord) -> Tool (APINode, SpecUnion) -> Tool (APINode, SpecEnum) -> Tool (APINode, APIType) -> Tool APINodeSource
Create a tool that acts on nodes from its action on individual specs.
Tool settings
data ToolSettings Source
Settings to control the behaviour of API tools. This record may
be extended in the future, so you should construct a value by
overriding individual fields of defaultToolSettings
.
warnOnOmittedInstance :: ToolSettings -> BoolSource
Generate a warning when an instance declaration is omitted because it already exists
defaultToolSettings :: ToolSettingsSource
Default settings designed to be overridden.