api-tools-0.8.0.1: DSL for generating API boilerplate and docs

Data.API.Tools.Combinators

Synopsis

# Documentation

data Tool a Source #

A Tool a is something that can generate TH declarations from a value of type a. Tools can be combined using the Monoid instance.

Instances

 Monoid (Tool a) Source # Methodsmempty :: Tool a #mappend :: Tool a -> Tool a -> Tool a #mconcat :: [Tool a] -> Tool a #

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

readTool :: (a -> Tool a) -> Tool a Source #

Make a tool that reads its argument to decide what to do

subTools :: Tool a -> Tool [a] Source #

Apply a tool that acts on elements of a list to the entire list

Apply a tool that acts on nodes to an entire API

Apply a tool that acts on datatype nodes (i.e. those that are not synonyms) to an entire API

Create a tool that acts on nodes from its action on individual specs.

# Tool settings

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.

Generate a warning when an instance declaration is omitted because it already exists

Rename the constructors of filtered newtypes and generate smart constructors that enforce the invariants

Default settings designed to be overridden.