| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Data.API.Tools.Example
Description
Tool for generating documentation-friendly examples
Synopsis
- class Example a where
- exampleTool :: APITool
- samplesTool :: Name -> APITool
Documentation
class Example a where Source #
The Example class is used to generate a documentation-friendly example for each type in the model
Minimal complete definition
Nothing
Methods
Generator for example values; defaults to arbitrary if not
specified
Instances
| Example Value Source # | |
| Example APINode Source # | |
| Example APIType Source # | |
| Example BasicType Source # | |
| Example Conversion Source # | |
Defined in Data.API.API.Gen Methods example :: Gen Conversion Source # | |
| Example DefaultValue Source # | |
Defined in Data.API.API.Gen Methods | |
| Example Field Source # | |
| Example Filter Source # | |
| Example IntRange Source # | |
| Example RegularExpression Source # | |
Defined in Data.API.API.Gen Methods | |
| Example Spec Source # | |
| Example SpecNewtype Source # | |
Defined in Data.API.API.Gen Methods example :: Gen SpecNewtype Source # | |
| Example TypeRef Source # | |
| Example UTCRange Source # | |
| Example Binary Source # | |
| Example Text Source # | |
| Example UTCTime Source # | |
| Example Bool Source # | |
| Example Int Source # | |
| Example a => Example (Maybe a) Source # | |
| Example a => Example [a] Source # | |
Defined in Data.API.Tools.Example | |
exampleTool :: APITool Source #
Tool to generate Example instances for types generated by
datatypesTool. This depends on quickCheckTool.
samplesTool :: Name -> APITool Source #
Generate a list of (type name, sample generator) pairs
corresponding to each type in the API, with samples encoded as
JSON. This depends on the Example instances generated by
exampleTool. It generates something like this:
samples :: [(String, Gen Value)]
samples = [("Foo", fmap toJSON (example :: Gen Foo)), ... ]