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

Safe HaskellNone




traversalTool :: TypeName -> TypeName -> APIToolSource

Build a traversal of the root type (first argument) that updates values of the second type, e.g. traversalTool Root Sub produces

 traverseSubRoot :: Applicative f => (Sub -> f Sub) -> Root -> f Root

along with similar functions for all the types nested inside Root that depend on Sub.

Note that types with custom representations will not have traversals generated automatically: if required, these must be defined manually in the same module as the call to traversalTool, otherwise the generated code will lead to scope errors.