Safe Haskell | None |
---|---|
Language | Haskell2010 |
- 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
- newtypeSmartConstructors :: ToolSettings -> Bool
- defaultToolSettings :: ToolSettings
Documentation
type APINodeTool = Tool APINode Source
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 a Source
Construct a tool that does not depend on any settings
mkTool :: (ToolSettings -> a -> Q [Dec]) -> Tool a Source
Construct a tool that may depend on the settings
contramapTool :: (a -> b) -> Tool b -> Tool a Source
Tool
is a contravariant functor
subTools :: Tool a -> Tool [a] Source
Apply a tool that acts on elements of a list to the entire list
apiDataTypeTool :: Tool APINode -> Tool API Source
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 APINode Source
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 -> Bool Source
Generate a warning when an instance declaration is omitted because it already exists
newtypeSmartConstructors :: ToolSettings -> Bool Source
Rename the constructors of filtered newtypes and generate smart constructors that enforce the invariants
defaultToolSettings :: ToolSettings Source
Default settings designed to be overridden.