woe-0.1.0.3: 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, simply do deriving Enum via WOE. This requires the DerivingVia extension provided by GHC 8.6.1+.

Documentation

class Eq a => IsoEnum a Source #

Minimal complete definition

mapping

mapping :: IsoEnum a => [(Int, a)] Source #

newtype 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] #