Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class Enum a where
- succ :: a -> a
- pred :: a -> a
- toEnum :: Integer -> a
- fromEnum :: a -> Integer
- enumFromTo :: a -> a -> [a]
- enumFromThenTo :: a -> a -> a -> [a]
Documentation
Class Enum
defines operations on sequentially ordered types.
The successor of a value. For numeric types, succ
adds 1.
For types that implement Ord
, succ x
should be the least element
that is greater than x
, and error
if there is none.
The predecessor of a value. For numeric types, pred
subtracts 1.
For types that implement Ord
, pred x
should be the greatest element
that is less than x
, and error
if there is none.
toEnum :: Integer -> a Source #
Convert from an Integer
.
fromEnum :: a -> Integer Source #
Convert to an Integer
.
enumFromTo :: a -> a -> [a] Source #
Construct a list from the given range (corresponds to [a..b]).
enumFromThenTo :: a -> a -> a -> [a] Source #
Construct a list from the given range (corresponds to [a,b..c]). This has the same semantics as the Haskell version,so if a==b and c>=b then you get an infinite list, which you probably don't want in Plutus Core.