api-tools-0.9.0.0: DSL for generating API boilerplate and docs
Safe HaskellNone
LanguageHaskell2010

Data.API.Tools.Enum

Description

A tool to generate maps to and from Text values corresponding to inhabitants of enumerated types

Synopsis

Documentation

enumTool :: APITool Source #

Tool to generate the maps between enumerations and Text strings named by text_enum_nm and map_enum_nm.

text_enum_nm :: APINode -> Name Source #

For an enum type E, name a function _text_E :: E -> Text that gives a string corresponding to the inhabitant of the type. For example, we generate something like this:

  _text_FrameRate :: FrameRate -> T.Text
  _text_FrameRate fr =
          case fr of
            FRauto    -> "auto"
            FR10      -> "10"
            FR15      -> "15"
            FR23_97   -> "23.97"
            FR24      -> "24"
            FR25      -> "25"
            FR29_97   -> "29.97"
            FR30      -> "30"
            FR60      -> "60"

map_enum_nm :: APINode -> Name Source #

For an enum type E, name a map from Text values to inhabitants of the type, for example:

_map_FrameRate :: Map Text FrameRate
_map_FrameRate = genTextMap _text_FrameRate