woe-0.1.0.0: Convenient typeclass for defining arbitrary-index enums.

Safe HaskellSafe
LanguageHaskell2010

Data.WOE

Description

WOE is an acronym for "Write-Once Enum". This package provides the IsoEnum class to allow for more convenient declaration of arbitrary-index enums. This removes the need for writing boilerplate 'toEnum'/'fromEnum' definitions if you were to implement Enum directly. To expose an Enum interface for your custom enum type (which we'll call X), simply do 'deriving Enum via WOE'. This requires the DerivingVia extension provided by more GHC 8.6.1+.

Documentation

data WOE a Source #

Constructors

WOE 

Fields

Instances
IsoEnum a => Enum (WOE a) Source # 
Instance details

Defined in Data.WOE

Methods

succ :: WOE a -> WOE a #

pred :: WOE a -> WOE a #

toEnum :: Int -> WOE a #

fromEnum :: WOE a -> Int #

enumFrom :: WOE a -> [WOE a] #

enumFromThen :: WOE a -> WOE a -> [WOE a] #

enumFromTo :: WOE a -> WOE a -> [WOE a] #

enumFromThenTo :: WOE a -> WOE a -> WOE a -> [WOE a] #