Safe HaskellSafe

Eta.Classes.Enum

Description

The Enum class defines operations on sequentially ordered types

Synopsis

Documentation

successor :: Enum a => a -> a #

Successor of a value

>>> successor 1
2

predecessor :: Enum a => a -> a #

Predecessor of a value

>>> predecessor 1
0

toEnumeration :: Enum a => Int -> a #

Converts an Int into the equivalent value of the enumeration

>>> toEnumeration 1 :: Bool
True

fromEnumeration :: Enum a => a -> Int #

Converts a value from an enumeration into the equivalent Int value

>>> fromEnumeration False
0

enumerateFrom :: Enum a => a -> [a] #

Generates a list from the beginning of the type to the end

>>> take 4 (enumerateFrom 0)
[0,1,2,3]
>>> enumerateFrom False
[False,True]

steppingEnumerateFrom :: Enum a => a -> a -> [a] #

Generates a list from the beginning of the type to the end, with steps

>>> take 4 (steppingEnumerateFrom 0 2)
[0,2,4,6]

enumerateFromTo :: Enum a => a -> a -> [a] #

Generates a list from the beginning of the type to the specified limit

>>> enumerateFromTo 0 3
[0,1,2,3]

steppingEnumerateFromTo :: Enum a => a -> a -> a -> [a] #

Generates a list from the beginning of the type to the specified limit, with steps

>>> steppingEnumerateFromTo 0 2 8
[0,2,4,6,8]

class Enum a where #

Minimal complete definition

toEnum, fromEnum

Methods

toEnum :: Int -> a #

fromEnum :: a -> Int #

Instances

Enum Bool 
Enum Char 
Enum Int 

Methods

succ :: Int -> Int

pred :: Int -> Int

toEnum :: Int -> Int #

fromEnum :: Int -> Int #

enumFrom :: Int -> [Int]

enumFromThen :: Int -> Int -> [Int]

enumFromTo :: Int -> Int -> [Int]

enumFromThenTo :: Int -> Int -> Int -> [Int]

Enum Int8 
Enum Int16 
Enum Int32 
Enum Int64 
Enum Integer 

Methods

succ :: Integer -> Integer

pred :: Integer -> Integer

toEnum :: Int -> Integer #

fromEnum :: Integer -> Int #

enumFrom :: Integer -> [Integer]

enumFromThen :: Integer -> Integer -> [Integer]

enumFromTo :: Integer -> Integer -> [Integer]

enumFromThenTo :: Integer -> Integer -> Integer -> [Integer]

Enum Ordering 
Enum Word 

Methods

succ :: Word -> Word

pred :: Word -> Word

toEnum :: Int -> Word #

fromEnum :: Word -> Int #

enumFrom :: Word -> [Word]

enumFromThen :: Word -> Word -> [Word]

enumFromTo :: Word -> Word -> [Word]

enumFromThenTo :: Word -> Word -> Word -> [Word]

Enum () 

Methods

succ :: () -> ()

pred :: () -> ()

toEnum :: Int -> () #

fromEnum :: () -> Int #

enumFrom :: () -> [()]

enumFromThen :: () -> () -> [()]

enumFromTo :: () -> () -> [()]

enumFromThenTo :: () -> () -> () -> [()]

Enum GeneralCategory 

Methods

succ :: GeneralCategory -> GeneralCategory

pred :: GeneralCategory -> GeneralCategory

toEnum :: Int -> GeneralCategory #

fromEnum :: GeneralCategory -> Int #

enumFrom :: GeneralCategory -> [GeneralCategory]

enumFromThen :: GeneralCategory -> GeneralCategory -> [GeneralCategory]

enumFromTo :: GeneralCategory -> GeneralCategory -> [GeneralCategory]

enumFromThenTo :: GeneralCategory -> GeneralCategory -> GeneralCategory -> [GeneralCategory]

Enum SourceUnpackedness 

Methods

succ :: SourceUnpackedness -> SourceUnpackedness

pred :: SourceUnpackedness -> SourceUnpackedness

toEnum :: Int -> SourceUnpackedness #

fromEnum :: SourceUnpackedness -> Int #

enumFrom :: SourceUnpackedness -> [SourceUnpackedness]

enumFromThen :: SourceUnpackedness -> SourceUnpackedness -> [SourceUnpackedness]

enumFromTo :: SourceUnpackedness -> SourceUnpackedness -> [SourceUnpackedness]

enumFromThenTo :: SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness -> [SourceUnpackedness]

Enum SourceStrictness 

Methods

succ :: SourceStrictness -> SourceStrictness

pred :: SourceStrictness -> SourceStrictness

toEnum :: Int -> SourceStrictness #

fromEnum :: SourceStrictness -> Int #

enumFrom :: SourceStrictness -> [SourceStrictness]

enumFromThen :: SourceStrictness -> SourceStrictness -> [SourceStrictness]

enumFromTo :: SourceStrictness -> SourceStrictness -> [SourceStrictness]

enumFromThenTo :: SourceStrictness -> SourceStrictness -> SourceStrictness -> [SourceStrictness]

Enum DecidedStrictness 

Methods

succ :: DecidedStrictness -> DecidedStrictness

pred :: DecidedStrictness -> DecidedStrictness

toEnum :: Int -> DecidedStrictness #

fromEnum :: DecidedStrictness -> Int #

enumFrom :: DecidedStrictness -> [DecidedStrictness]

enumFromThen :: DecidedStrictness -> DecidedStrictness -> [DecidedStrictness]

enumFromTo :: DecidedStrictness -> DecidedStrictness -> [DecidedStrictness]

enumFromThenTo :: DecidedStrictness -> DecidedStrictness -> DecidedStrictness -> [DecidedStrictness]

Enum Associativity 

Methods

succ :: Associativity -> Associativity

pred :: Associativity -> Associativity

toEnum :: Int -> Associativity #

fromEnum :: Associativity -> Int #

enumFrom :: Associativity -> [Associativity]

enumFromThen :: Associativity -> Associativity -> [Associativity]

enumFromTo :: Associativity -> Associativity -> [Associativity]

enumFromThenTo :: Associativity -> Associativity -> Associativity -> [Associativity]

Integral a => Enum (Ratio a) 

Methods

succ :: Ratio a -> Ratio a

pred :: Ratio a -> Ratio a

toEnum :: Int -> Ratio a #

fromEnum :: Ratio a -> Int #

enumFrom :: Ratio a -> [Ratio a]

enumFromThen :: Ratio a -> Ratio a -> [Ratio a]

enumFromTo :: Ratio a -> Ratio a -> [Ratio a]

enumFromThenTo :: Ratio a -> Ratio a -> Ratio a -> [Ratio a]

Enum (Proxy k s) 

Methods

succ :: Proxy k s -> Proxy k s

pred :: Proxy k s -> Proxy k s

toEnum :: Int -> Proxy k s #

fromEnum :: Proxy k s -> Int #

enumFrom :: Proxy k s -> [Proxy k s]

enumFromThen :: Proxy k s -> Proxy k s -> [Proxy k s]

enumFromTo :: Proxy k s -> Proxy k s -> [Proxy k s]

enumFromThenTo :: Proxy k s -> Proxy k s -> Proxy k s -> [Proxy k s]

Enum (f a) => Enum (Alt k f a) 

Methods

succ :: Alt k f a -> Alt k f a

pred :: Alt k f a -> Alt k f a

toEnum :: Int -> Alt k f a #

fromEnum :: Alt k f a -> Int #

enumFrom :: Alt k f a -> [Alt k f a]

enumFromThen :: Alt k f a -> Alt k f a -> [Alt k f a]

enumFromTo :: Alt k f a -> Alt k f a -> [Alt k f a]

enumFromThenTo :: Alt k f a -> Alt k f a -> Alt k f a -> [Alt k f a]

(~) k a b => Enum ((:~:) k a b) 

Methods

succ :: (k :~: a) b -> (k :~: a) b

pred :: (k :~: a) b -> (k :~: a) b

toEnum :: Int -> (k :~: a) b #

fromEnum :: (k :~: a) b -> Int #

enumFrom :: (k :~: a) b -> [(k :~: a) b]

enumFromThen :: (k :~: a) b -> (k :~: a) b -> [(k :~: a) b]

enumFromTo :: (k :~: a) b -> (k :~: a) b -> [(k :~: a) b]

enumFromThenTo :: (k :~: a) b -> (k :~: a) b -> (k :~: a) b -> [(k :~: a) b]

toEnum :: Enum a => Int -> a #

fromEnum :: Enum a => a -> Int #