the-sett / elm-enum / Enum

Enum provides support for various different ways of defining an enum in Elm.


type Enum a

An enum is a list of possible values and a function for turning an instance of one into a string.

decoder : Enum a -> Json.Decode.Decoder a

JSON Decoder for an enum

encoder : Enum a -> a -> Json.Encode.Value

JSON Encoder for an enum.

find : Enum a -> String -> Maybe a

Looks up an instance of an enum from its string representation.

make : List a -> (a -> String) -> Enum a

Creates an enum definition from a list of possible values and a definition opf the toString function.

toString : Enum a -> a -> String

Turns an instance of an enum into a string.