api-tools-0.10.1.0: DSL for generating API boilerplate and docs
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.API.Tools.Traversal

Synopsis

Documentation

traversalTool :: TypeName -> TypeName -> APITool Source #

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.

traversalsTool :: [TypeName] -> TypeName -> APITool Source #

Like traversalTool, but it allows passing a list of "roots", to avoid conflicting declarations.