Safe Haskell | None |
---|---|
Language | Haskell2010 |
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 :: Bool
False
>>>
map to F.universe :: [Bool]
[False,True]
>>>
map (to . (+1) . from) [LT, EQ, GT] :: [Ordering] -- Num Fin is modulo arithmetic
[EQ,GT,LT]
Nothing
from :: a -> Fin ( EnumSize a) Source #
Converts a value to its index.
to :: Fin ( EnumSize a) -> a Source #
Converts from index to the original value.