Esc
Start typing to search...

Enum Module

Functions for working with enum values.

Functions

  • toString: Convert an enum variant to its string representation, using display strings when available.

Functions

Enum.toString

a -> String

Convert an enum variant to its string representation. Uses the display string when available, otherwise falls back to the variant name.

Example:
type Direction = North | South | East | West
import Enum

Enum.toString North
Try it

Notes: For variants with data, the data is formatted after the variant name or display string.