| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Fin.Enum
Contents
Description
This module is designed to be imported qualified:
import qualified Data.Fin.Enum as E
Documentation
Generic enumerations.
Examples:
>>>from ()0
>>>to 0 :: ()()
>>>to 0 :: BoolFalse
>>>map to F.universe :: [Bool][False,True]
>>>map (to . (+1) . from) [LT, EQ, GT] :: [Ordering] -- Num Fin is modulo arithmetic[EQ,GT,LT]
Minimal complete definition
Nothing
Methods
from :: a -> Fin (EnumSize a) Source #
Converts a value to its index.
from :: (Generic a, GFrom a, EnumSize a ~ GEnumSize a) => a -> Fin (EnumSize a) Source #
Converts a value to its index.
to :: Fin (EnumSize a) -> a Source #
Converts from index to the original value.
to :: (Generic a, GTo a, EnumSize a ~ GEnumSize a) => Fin (EnumSize a) -> a Source #
Converts from index to the original value.