Hoogle Search
Within LTS Haskell 24.33 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
decodeNum32 :: Num a => ByteString -> anetwork-transport Network.Transport.Internal Decode any Num type from 32 bits by using fromIntegral to convert from a Word32.
encodeEnum16 :: Enum a => a -> ByteStringnetwork-transport Network.Transport.Internal Encode an Enum in 16 bits by encoding its signed Int equivalent (beware of truncation, an Enum may contain more than 2^16 points).
encodeEnum32 :: Enum a => a -> ByteStringnetwork-transport Network.Transport.Internal Encode an Enum in 32 bits by encoding its signed Int equivalent (beware of truncation, an Enum may contain more than 2^32 points).
tryToEnum :: (Enum a, Bounded a) => Int -> Maybe anetwork-transport Network.Transport.Internal Safe version of toEnum
-
Reexports Enum related typeclasses and functions. Also introduces a few useful helpers to work with Enums. Note: universe, universeNonEmpty and inverseMap were previously in the extra modules, but due to their benefit in different use cases. If you imported Relude.Extra.Enum module, you can remove it now, as these functions are reexported in the main Relude module.
-
relude Relude.Enum Class Enum defines operations on sequentially ordered types. The enumFrom... methods are used in Haskell's translation of arithmetic sequences. Instances of Enum may be derived for any enumeration type (types whose constructors have no fields). The nullary constructors are assumed to be numbered left-to-right by fromEnum from 0 through n-1. See Chapter 10 of the Haskell Report for more details. For any type that is an instance of class Bounded as well as Enum, the following should hold:
- The calls succ maxBound and pred minBound should result in a runtime error.
- fromEnum and toEnum should give a runtime error if the result value is not representable in the result type. For example, toEnum 7 :: Bool is an error.
- enumFrom and enumFromThen should be defined with an implicit bound, thus:
enumFrom x = enumFromTo x maxBound enumFromThen x y = enumFromThenTo x y bound where bound | fromEnum y >= fromEnum x = maxBound | otherwise = minBound
boundedEnumFrom :: (Enum a, Bounded a) => a -> [a]relude Relude.Enum No documentation available.
boundedEnumFromThen :: (Enum a, Bounded a) => a -> a -> [a]relude Relude.Enum No documentation available.
enumFrom :: Enum a => a -> [a]relude Relude.Enum Used in Haskell's translation of [n..] with [n..] = enumFrom n, a possible implementation being enumFrom n = n : enumFrom (succ n).
Examples
enumFrom 4 :: [Integer] = [4,5,6,7,...]
enumFrom 6 :: [Int] = [6,7,8,9,...,maxBound :: Int]
enumFromThen :: Enum a => a -> a -> [a]relude Relude.Enum Used in Haskell's translation of [n,n'..] with [n,n'..] = enumFromThen n n', a possible implementation being enumFromThen n n' = n : n' : worker (f x) (f x n'), worker s v = v : worker s (s v), x = fromEnum n' - fromEnum n and
f n y | n > 0 = f (n - 1) (succ y) | n < 0 = f (n + 1) (pred y) | otherwise = y
Examples
enumFromThen 4 6 :: [Integer] = [4,6,8,10...]
enumFromThen 6 2 :: [Int] = [6,2,-2,-6,...,minBound :: Int]