relude-1.2.2.0: Safe, performant, user-friendly and lightweight Haskell Standard Library
Copyright(c) 2021-2023 Kowainik
LicenseMIT
MaintainerKowainik <xrom.xkov@gmail.com>
StabilityStable
PortabilityPortable
Safe HaskellSafe
LanguageHaskell2010

Relude.Enum

Description

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.

Since: 1.0.0.0

Synopsis

Useful combinators for Enums

universe :: (Bounded a, Enum a) => [a] Source #

Returns all values of some Bounded Enum in ascending order.

>>> universe :: [Bool]
[False,True]
>>> universe @Ordering
[LT,EQ,GT]
>>> data TrafficLight = Red | Blue | Green deriving (Show, Enum, Bounded)
>>> universe :: [TrafficLight]
[Red,Blue,Green]
>>> data Singleton = Singleton deriving (Show, Enum, Bounded)
>>> universe @Singleton
[Singleton]

Since: 0.1.0

universeNonEmpty :: (Bounded a, Enum a) => NonEmpty a Source #

Like universe, but returns NonEmpty list of some enumeration

>>> universeNonEmpty :: NonEmpty Bool
False :| [True]
>>> universeNonEmpty @Ordering
LT :| [EQ,GT]
>>> data TrafficLight = Red | Blue | Green deriving (Show, Eq, Enum, Bounded)
>>> universeNonEmpty :: NonEmpty TrafficLight
Red :| [Blue,Green]
>>> data Singleton = Singleton deriving (Show, Eq, Enum, Bounded)
>>> universeNonEmpty @Singleton
Singleton :| []

Since: 0.7.0.0

inverseMap :: (Bounded a, Enum a, Ord k) => (a -> k) -> k -> Maybe a Source #

inverseMap f creates a function that is the inverse of a given function f. It does so by constructing Map internally for each value f a. The implementation makes sure that the Map is constructed only once and then shared for every call.

Memory usage note: don't inverse functions that have types like Int as their input. In this case the created Map will have huge size.

The complexity of reversed mapping is \(\mathcal{O}(\log n)\).

Performance note: make sure to specialize monomorphic type of your functions that use inverseMap to avoid Map reconstruction.

One of the common inverseMap use-case is inverting the show or a show-like function.

>>> data Color = Red | Green | Blue deriving (Show, Enum, Bounded)
>>> parse = inverseMap show :: String -> Maybe Color
>>> parse "Red"
Just Red
>>> parse "Black"
Nothing

Correctness note: inverseMap expects injective function as its argument, i.e. the function must map distinct arguments to distinct values.

Typical usage of this function looks like this:

data GhcVer
    = Ghc802
    | Ghc822
    | Ghc844
    | Ghc865
    | Ghc881
    deriving (Eq, Ord, Show, Enum, Bounded)

showGhcVer :: GhcVer -> Text
showGhcVer = \case
    Ghc802 -> "8.0.2"
    Ghc822 -> "8.2.2"
    Ghc844 -> "8.4.4"
    Ghc865 -> "8.6.5"
    Ghc881 -> "8.8.1"

parseGhcVer :: Text -> Maybe GhcVer
parseGhcVer = inverseMap showGhcVer

Since: 0.1.1

Base reexports

class Enum a where #

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:

   enumFrom     x   = enumFromTo     x maxBound
   enumFromThen x y = enumFromThenTo x y bound
     where
       bound | fromEnum y >= fromEnum x = maxBound
             | otherwise                = minBound

Minimal complete definition

toEnum, fromEnum

Methods

succ :: a -> a #

Successor of a value. For numeric types, succ adds 1.

pred :: a -> a #

Predecessor of a value. For numeric types, pred subtracts 1.

toEnum :: Int -> a #

Convert from an Int.

fromEnum :: a -> Int #

Convert to an Int. It is implementation-dependent what fromEnum returns when applied to a value that is too large to fit in an Int.

enumFrom :: a -> [a] #

Used in Haskell's translation of [n..] with [n..] = enumFrom n, a possible implementation being enumFrom n = n : enumFrom (succ n).

Examples

Expand
  • enumFrom 4 :: [Integer] = [4,5,6,7,...]
  • enumFrom 6 :: [Int] = [6,7,8,9,...,maxBound :: Int]

enumFromThen :: a -> a -> [a] #

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

Expand
  • enumFromThen 4 6 :: [Integer] = [4,6,8,10...]
  • enumFromThen 6 2 :: [Int] = [6,2,-2,-6,...,minBound :: Int]

enumFromTo :: a -> a -> [a] #

Used in Haskell's translation of [n..m] with [n..m] = enumFromTo n m, a possible implementation being

  enumFromTo n m
     | n <= m = n : enumFromTo (succ n) m
     | otherwise = []
  

Examples

Expand
  • enumFromTo 6 10 :: [Int] = [6,7,8,9,10]
  • enumFromTo 42 1 :: [Integer] = []

enumFromThenTo :: a -> a -> a -> [a] #

Used in Haskell's translation of [n,n'..m] with [n,n'..m] = enumFromThenTo n n' m, a possible implementation being enumFromThenTo n n' m = worker (f x) (c x) n m, x = fromEnum n' - fromEnum n, c x = bool (>=) ((x 0)

  f n y
     | n > 0 = f (n - 1) (succ y)
     | n < 0 = f (n + 1) (pred y)
     | otherwise = y
  

and

  worker s c v m
     | c v m = v : worker s c (s v) m
     | otherwise = []
  

Examples

Expand
  • enumFromThenTo 4 2 -6 :: [Integer] = [4,2,0,-2,-4,-6]
  • enumFromThenTo 6 8 2 :: [Int] = []

Instances

Instances details
Enum Extension 
Instance details

Defined in GHC.LanguageExtensions.Type

Enum Associativity

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Generics

Enum DecidedStrictness

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Generics

Enum SourceStrictness

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Generics

Enum SourceUnpackedness

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Generics

Enum IOMode

@since base-4.2.0.0

Instance details

Defined in GHC.Internal.IO.IOMode

Enum Int16

@since base-2.01

Instance details

Defined in GHC.Internal.Int

Enum Int32

@since base-2.01

Instance details

Defined in GHC.Internal.Int

Enum Int64

@since base-2.01

Instance details

Defined in GHC.Internal.Int

Enum Int8

@since base-2.01

Instance details

Defined in GHC.Internal.Int

Methods

succ :: Int8 -> Int8 #

pred :: Int8 -> Int8 #

toEnum :: Int -> Int8 #

fromEnum :: Int8 -> Int #

enumFrom :: Int8 -> [Int8] #

enumFromThen :: Int8 -> Int8 -> [Int8] #

enumFromTo :: Int8 -> Int8 -> [Int8] #

enumFromThenTo :: Int8 -> Int8 -> Int8 -> [Int8] #

Enum DoCostCentres

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.RTS.Flags

Enum DoHeapProfile

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.RTS.Flags

Enum DoTrace

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.RTS.Flags

Enum GiveGCStats

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.RTS.Flags

Enum IoSubSystem

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.RTS.Flags

Enum Word16

@since base-2.01

Instance details

Defined in GHC.Internal.Word

Enum Word32

@since base-2.01

Instance details

Defined in GHC.Internal.Word

Enum Word64

@since base-2.01

Instance details

Defined in GHC.Internal.Word

Enum Word8

@since base-2.01

Instance details

Defined in GHC.Internal.Word

Enum Ordering

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Enum Undefined Source # 
Instance details

Defined in Relude.Debug

Enum I8 
Instance details

Defined in Data.Text.Foreign

Methods

succ :: I8 -> I8 #

pred :: I8 -> I8 #

toEnum :: Int -> I8 #

fromEnum :: I8 -> Int #

enumFrom :: I8 -> [I8] #

enumFromThen :: I8 -> I8 -> [I8] #

enumFromTo :: I8 -> I8 -> [I8] #

enumFromThenTo :: I8 -> I8 -> I8 -> [I8] #

Enum FPFormat 
Instance details

Defined in Data.Text.Lazy.Builder.RealFloat

Enum Integer

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Enum Natural

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Enum

Enum ()

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

succ :: () -> () #

pred :: () -> () #

toEnum :: Int -> () #

fromEnum :: () -> Int #

enumFrom :: () -> [()] #

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

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

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

Enum Bool

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

succ :: Bool -> Bool #

pred :: Bool -> Bool #

toEnum :: Int -> Bool #

fromEnum :: Bool -> Int #

enumFrom :: Bool -> [Bool] #

enumFromThen :: Bool -> Bool -> [Bool] #

enumFromTo :: Bool -> Bool -> [Bool] #

enumFromThenTo :: Bool -> Bool -> Bool -> [Bool] #

Enum Char

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

succ :: Char -> Char #

pred :: Char -> Char #

toEnum :: Int -> Char #

fromEnum :: Char -> Int #

enumFrom :: Char -> [Char] #

enumFromThen :: Char -> Char -> [Char] #

enumFromTo :: Char -> Char -> [Char] #

enumFromThenTo :: Char -> Char -> Char -> [Char] #

Enum Int

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

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 Levity

@since base-4.16.0.0

Instance details

Defined in GHC.Internal.Enum

Enum VecCount

@since base-4.10.0.0

Instance details

Defined in GHC.Internal.Enum

Enum VecElem

@since base-4.10.0.0

Instance details

Defined in GHC.Internal.Enum

Enum Word

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

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 a => Enum (First a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

succ :: First a -> First a #

pred :: First a -> First a #

toEnum :: Int -> First a #

fromEnum :: First a -> Int #

enumFrom :: First a -> [First a] #

enumFromThen :: First a -> First a -> [First a] #

enumFromTo :: First a -> First a -> [First a] #

enumFromThenTo :: First a -> First a -> First a -> [First a] #

Enum a => Enum (Last a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

succ :: Last a -> Last a #

pred :: Last a -> Last a #

toEnum :: Int -> Last a #

fromEnum :: Last a -> Int #

enumFrom :: Last a -> [Last a] #

enumFromThen :: Last a -> Last a -> [Last a] #

enumFromTo :: Last a -> Last a -> [Last a] #

enumFromThenTo :: Last a -> Last a -> Last a -> [Last a] #

Enum a => Enum (Max a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

succ :: Max a -> Max a #

pred :: Max a -> Max a #

toEnum :: Int -> Max a #

fromEnum :: Max a -> Int #

enumFrom :: Max a -> [Max a] #

enumFromThen :: Max a -> Max a -> [Max a] #

enumFromTo :: Max a -> Max a -> [Max a] #

enumFromThenTo :: Max a -> Max a -> Max a -> [Max a] #

Enum a => Enum (Min a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

succ :: Min a -> Min a #

pred :: Min a -> Min a #

toEnum :: Int -> Min a #

fromEnum :: Min a -> Int #

enumFrom :: Min a -> [Min a] #

enumFromThen :: Min a -> Min a -> [Min a] #

enumFromTo :: Min a -> Min a -> [Min a] #

enumFromThenTo :: Min a -> Min a -> Min a -> [Min a] #

Enum a => Enum (WrappedMonoid a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Enum a => Enum (Identity a)

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Functor.Identity

(Enum a, Bounded a, Eq a) => Enum (Down a)

Swaps succ and pred of the underlying type.

@since base-4.18.0.0

Instance details

Defined in GHC.Internal.Data.Ord

Methods

succ :: Down a -> Down a #

pred :: Down a -> Down a #

toEnum :: Int -> Down a #

fromEnum :: Down a -> Int #

enumFrom :: Down a -> [Down a] #

enumFromThen :: Down a -> Down a -> [Down a] #

enumFromTo :: Down a -> Down a -> [Down a] #

enumFromThenTo :: Down a -> Down a -> Down a -> [Down a] #

Integral a => Enum (Ratio a)

@since base-2.0.1

Instance details

Defined in GHC.Internal.Real

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 a => Enum (Solo a) 
Instance details

Defined in GHC.Internal.Enum

Methods

succ :: Solo a -> Solo a #

pred :: Solo a -> Solo a #

toEnum :: Int -> Solo a #

fromEnum :: Solo a -> Int #

enumFrom :: Solo a -> [Solo a] #

enumFromThen :: Solo a -> Solo a -> [Solo a] #

enumFromTo :: Solo a -> Solo a -> [Solo a] #

enumFromThenTo :: Solo a -> Solo a -> Solo a -> [Solo a] #

Enum (Fixed a)

Recall that, for numeric types, succ and pred typically add and subtract 1, respectively. This is not true in the case of Fixed, whose successor and predecessor functions intuitively return the "next" and "previous" values in the enumeration. The results of these functions thus depend on the resolution of the Fixed value. For example, when enumerating values of resolution 10^-3 of type Milli = Fixed E3,

>>> succ (0.000 :: Milli)
0.001

and likewise

>>> pred (0.000 :: Milli)
-0.001

In other words, succ and pred increment and decrement a fixed-precision value by the least amount such that the value's resolution is unchanged. For example, 10^-12 is the smallest (positive) amount that can be added to a value of type Pico = Fixed E12 without changing its resolution, and so

>>> succ (0.000000000000 :: Pico)
0.000000000001

and similarly

>>> pred (0.000000000000 :: Pico)
-0.000000000001

This is worth bearing in mind when defining Fixed arithmetic sequences. In particular, you may be forgiven for thinking the sequence

  [1..10] :: [Pico]

evaluates to [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] :: [Pico].

However, this is not true. On the contrary, similarly to the above implementations of succ and pred, enumFromTo :: Pico -> Pico -> [Pico] has a "step size" of 10^-12. Hence, the list [1..10] :: [Pico] has the form

  [1.000000000000, 1.00000000001, 1.00000000002, ..., 10.000000000000]

and contains 9 * 10^12 + 1 values.

Since: base-2.1

Instance details

Defined in Data.Fixed

Methods

succ :: Fixed a -> Fixed a #

pred :: Fixed a -> Fixed a #

toEnum :: Int -> Fixed a #

fromEnum :: Fixed a -> Int #

enumFrom :: Fixed a -> [Fixed a] #

enumFromThen :: Fixed a -> Fixed a -> [Fixed a] #

enumFromTo :: Fixed a -> Fixed a -> [Fixed a] #

enumFromThenTo :: Fixed a -> Fixed a -> Fixed a -> [Fixed a] #

Enum (Proxy s)

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Proxy

Methods

succ :: Proxy s -> Proxy s #

pred :: Proxy s -> Proxy s #

toEnum :: Int -> Proxy s #

fromEnum :: Proxy s -> Int #

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

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

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

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

Enum a => Enum (Const a b)

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Functor.Const

Methods

succ :: Const a b -> Const a b #

pred :: Const a b -> Const a b #

toEnum :: Int -> Const a b #

fromEnum :: Const a b -> Int #

enumFrom :: Const a b -> [Const a b] #

enumFromThen :: Const a b -> Const a b -> [Const a b] #

enumFromTo :: Const a b -> Const a b -> [Const a b] #

enumFromThenTo :: Const a b -> Const a b -> Const a b -> [Const a b] #

Enum (f a) => Enum (Ap f a)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

succ :: Ap f a -> Ap f a #

pred :: Ap f a -> Ap f a #

toEnum :: Int -> Ap f a #

fromEnum :: Ap f a -> Int #

enumFrom :: Ap f a -> [Ap f a] #

enumFromThen :: Ap f a -> Ap f a -> [Ap f a] #

enumFromTo :: Ap f a -> Ap f a -> [Ap f a] #

enumFromThenTo :: Ap f a -> Ap f a -> Ap f a -> [Ap f a] #

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

@since base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

succ :: Alt f a -> Alt f a #

pred :: Alt f a -> Alt f a #

toEnum :: Int -> Alt f a #

fromEnum :: Alt f a -> Int #

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

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

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

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

Enum (f (g a)) => Enum (Compose f g a)

Since: base-4.19.0.0

Instance details

Defined in Data.Functor.Compose

Methods

succ :: Compose f g a -> Compose f g a #

pred :: Compose f g a -> Compose f g a #

toEnum :: Int -> Compose f g a #

fromEnum :: Compose f g a -> Int #

enumFrom :: Compose f g a -> [Compose f g a] #

enumFromThen :: Compose f g a -> Compose f g a -> [Compose f g a] #

enumFromTo :: Compose f g a -> Compose f g a -> [Compose f g a] #

enumFromThenTo :: Compose f g a -> Compose f g a -> Compose f g a -> [Compose f g a] #

class Bounded a where #

The Bounded class is used to name the upper and lower limits of a type. Ord is not a superclass of Bounded since types that are not totally ordered may also have upper and lower bounds.

The Bounded class may be derived for any enumeration type; minBound is the first constructor listed in the data declaration and maxBound is the last. Bounded may also be derived for single-constructor datatypes whose constituent types are in Bounded.

Methods

minBound :: a #

maxBound :: a #

Instances

Instances details
Bounded Extension 
Instance details

Defined in GHC.LanguageExtensions.Type

Bounded All

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

minBound :: All #

maxBound :: All #

Bounded Any

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

minBound :: Any #

maxBound :: Any #

Bounded Associativity

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Generics

Bounded DecidedStrictness

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Generics

Bounded SourceStrictness

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Generics

Bounded SourceUnpackedness

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Generics

Bounded Int16

@since base-2.01

Instance details

Defined in GHC.Internal.Int

Bounded Int32

@since base-2.01

Instance details

Defined in GHC.Internal.Int

Bounded Int64

@since base-2.01

Instance details

Defined in GHC.Internal.Int

Bounded Int8

@since base-2.01

Instance details

Defined in GHC.Internal.Int

Bounded Word16

@since base-2.01

Instance details

Defined in GHC.Internal.Word

Bounded Word32

@since base-2.01

Instance details

Defined in GHC.Internal.Word

Bounded Word64

@since base-2.01

Instance details

Defined in GHC.Internal.Word

Bounded Word8

@since base-2.01

Instance details

Defined in GHC.Internal.Word

Bounded Ordering

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Bounded Undefined Source # 
Instance details

Defined in Relude.Debug

Bounded I8 
Instance details

Defined in Data.Text.Foreign

Methods

minBound :: I8 #

maxBound :: I8 #

Bounded FPFormat 
Instance details

Defined in Data.Text.Lazy.Builder.RealFloat

Bounded ()

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: () #

maxBound :: () #

Bounded Bool

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Bounded Char

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Bounded Int

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: Int #

maxBound :: Int #

Bounded Levity

@since base-4.16.0.0

Instance details

Defined in GHC.Internal.Enum

Bounded VecCount

@since base-4.10.0.0

Instance details

Defined in GHC.Internal.Enum

Bounded VecElem

@since base-4.10.0.0

Instance details

Defined in GHC.Internal.Enum

Bounded Word

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Bounded a => Bounded (First a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

minBound :: First a #

maxBound :: First a #

Bounded a => Bounded (Last a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

minBound :: Last a #

maxBound :: Last a #

Bounded a => Bounded (Max a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

minBound :: Max a #

maxBound :: Max a #

Bounded a => Bounded (Min a)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

minBound :: Min a #

maxBound :: Min a #

Bounded m => Bounded (WrappedMonoid m)

Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Bounded a => Bounded (Identity a)

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Functor.Identity

Bounded a => Bounded (Down a)

Swaps minBound and maxBound of the underlying type.

@since base-4.14.0.0

Instance details

Defined in GHC.Internal.Data.Ord

Methods

minBound :: Down a #

maxBound :: Down a #

Bounded a => Bounded (Dual a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

minBound :: Dual a #

maxBound :: Dual a #

Bounded a => Bounded (Product a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Bounded a => Bounded (Sum a)

@since base-2.01

Instance details

Defined in GHC.Internal.Data.Semigroup.Internal

Methods

minBound :: Sum a #

maxBound :: Sum a #

Bounded a => Bounded (Solo a) 
Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: Solo a #

maxBound :: Solo a #

Bounded (Proxy t)

@since base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Proxy

Methods

minBound :: Proxy t #

maxBound :: Proxy t #

(Bounded a, Bounded b) => Bounded (a, b)

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: (a, b) #

maxBound :: (a, b) #

Bounded a => Bounded (Const a b)

@since base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Functor.Const

Methods

minBound :: Const a b #

maxBound :: Const a b #

(Applicative f, Bounded a) => Bounded (Ap f a)

@since base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Monoid

Methods

minBound :: Ap f a #

maxBound :: Ap f a #

(Bounded a, Bounded b, Bounded c) => Bounded (a, b, c)

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: (a, b, c) #

maxBound :: (a, b, c) #

(Bounded a, Bounded b, Bounded c, Bounded d) => Bounded (a, b, c, d)

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: (a, b, c, d) #

maxBound :: (a, b, c, d) #

Bounded (f (g a)) => Bounded (Compose f g a)

Since: base-4.19.0.0

Instance details

Defined in Data.Functor.Compose

Methods

minBound :: Compose f g a #

maxBound :: Compose f g a #

(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e) => Bounded (a, b, c, d, e)

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: (a, b, c, d, e) #

maxBound :: (a, b, c, d, e) #

(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f) => Bounded (a, b, c, d, e, f)

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: (a, b, c, d, e, f) #

maxBound :: (a, b, c, d, e, f) #

(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g) => Bounded (a, b, c, d, e, f, g)

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: (a, b, c, d, e, f, g) #

maxBound :: (a, b, c, d, e, f, g) #

(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h) => Bounded (a, b, c, d, e, f, g, h)

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: (a, b, c, d, e, f, g, h) #

maxBound :: (a, b, c, d, e, f, g, h) #

(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i) => Bounded (a, b, c, d, e, f, g, h, i)

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: (a, b, c, d, e, f, g, h, i) #

maxBound :: (a, b, c, d, e, f, g, h, i) #

(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j) => Bounded (a, b, c, d, e, f, g, h, i, j)

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: (a, b, c, d, e, f, g, h, i, j) #

maxBound :: (a, b, c, d, e, f, g, h, i, j) #

(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k) => Bounded (a, b, c, d, e, f, g, h, i, j, k)

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: (a, b, c, d, e, f, g, h, i, j, k) #

maxBound :: (a, b, c, d, e, f, g, h, i, j, k) #

(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l)

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: (a, b, c, d, e, f, g, h, i, j, k, l) #

maxBound :: (a, b, c, d, e, f, g, h, i, j, k, l) #

(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m)

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: (a, b, c, d, e, f, g, h, i, j, k, l, m) #

maxBound :: (a, b, c, d, e, f, g, h, i, j, k, l, m) #

(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m, Bounded n) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m, n)

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) #

maxBound :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) #

(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m, Bounded n, Bounded o) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)

@since base-2.01

Instance details

Defined in GHC.Internal.Enum

Methods

minBound :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) #

maxBound :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) #

boundedEnumFrom :: (Enum a, Bounded a) => a -> [a] #

boundedEnumFromThen :: (Enum a, Bounded a) => a -> a -> [a] #