Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Enumeration functions.
Synopsis
- genericFromEnum :: (Integral i, Enum e) => e -> i
- genericToEnum :: (Integral i, Enum e) => i -> e
- enum_from_to_cyclic :: (Bounded a, Enum a) => a -> a -> [a]
- enum_from_to_reverse :: Enum a => a -> a -> [a]
- enum_univ :: (Bounded t, Enum t) => [t]
- enum_list_gaps :: (Enum t, Eq t) => [t] -> [t]
- enum_set_gaps :: (Enum t, Eq t, Ord t) => [t] -> [t]
Documentation
enum_from_to_cyclic :: (Bounded a, Enum a) => a -> a -> [a] Source #
Variant of enumFromTo
that, if p is after q, cycles from
maxBound
to minBound
.
import Data.Word enum_from_to_cyclic (254 :: Word8) 1 == [254,255,0,1]
enum_from_to_reverse :: Enum a => a -> a -> [a] Source #
Variant of enumFromTo
that, if p is after q, enumerates
from q to p.
enum_from_to_reverse 5 1 == [5,4,3,2,1] enum_from_to_reverse 1 5 == enumFromTo 1 5
enum_univ :: (Bounded t, Enum t) => [t] Source #
All elements in sequence.
(enum_univ :: [Data.Word.Word8]) == [0 .. 255]
enum_list_gaps :: (Enum t, Eq t) => [t] -> [t] Source #
List of Enum
values not in sorted input list.
enum_list_gaps "abdh" == "cefg"