mixed-types-num-0.5.12: Alternative Prelude with numeric and logic expressions typed bottom-up

Numeric.MixedTypes.PreludeHiding

Description

Prelude without operations that clash with MixedTypes

Synopsis

# Documentation

(++) :: [a] -> [a] -> [a] infixr 5 #

Append two lists, i.e.,

[x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]
[x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]

If the first list is not finite, the result is the first list.

seq :: forall {r :: RuntimeRep} a (b :: TYPE r). a -> b -> b infixr 0 #

The value of seq a b is bottom if a is bottom, and otherwise equal to b. In other words, it evaluates the first argument a to weak head normal form (WHNF). seq is usually introduced to improve performance by avoiding unneeded laziness.

A note on evaluation order: the expression seq a b does not guarantee that a will be evaluated before b. The only guarantee given by seq is that the both a and b will be evaluated before seq returns a value. In particular, this means that b may be evaluated before a. If you need to guarantee a specific order of evaluation, you must use the function pseq from the "parallel" package.

filter :: (a -> Bool) -> [a] -> [a] #

$$\mathcal{O}(n)$$. filter, applied to a predicate and a list, returns the list of those elements that satisfy the predicate; i.e.,

filter p xs = [ x | x <- xs, p x]
>>> filter odd [1, 2, 3]
[1,3]


zip :: [a] -> [b] -> [(a, b)] #

$$\mathcal{O}(\min(m,n))$$. zip takes two lists and returns a list of corresponding pairs.

>>> zip [1, 2] ['a', 'b']
[(1,'a'),(2,'b')]


If one input list is shorter than the other, excess elements of the longer list are discarded, even if one of the lists is infinite:

>>> zip [1] ['a', 'b']
[(1,'a')]
>>> zip [1, 2] ['a']
[(1,'a')]
>>> zip [] [1..]
[]
>>> zip [1..] []
[]


zip is right-lazy:

>>> zip [] undefined
[]
>>> zip undefined []
*** Exception: Prelude.undefined
...


zip is capable of list fusion, but it is restricted to its first list argument and its resulting list.

print :: Show a => a -> IO () #

The print function outputs a value of any printable type to the standard output device. Printable types are those that are instances of class Show; print converts values to strings for output using the show operation and adds a newline.

For example, a program to print the first 20 integers and their powers of 2 could be written as:

main = print ([(n, 2^n) | n <- [0..19]])

fst :: (a, b) -> a #

Extract the first component of a pair.

snd :: (a, b) -> b #

Extract the second component of a pair.

otherwise is defined as the value True. It helps to make guards more readable. eg.

 f x | x < 0     = ...
| otherwise = ...

map :: (a -> b) -> [a] -> [b] #

$$\mathcal{O}(n)$$. map f xs is the list obtained by applying f to each element of xs, i.e.,

map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn]
map f [x1, x2, ...] == [f x1, f x2, ...]
>>> map (+1) [1, 2, 3]
[2,3,4]


($) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b infixr 0 # Application operator. This operator is redundant, since ordinary application (f x) means the same as (f$ x). However, $ has low, right-associative binding precedence, so it sometimes allows parentheses to be omitted; for example: f$ g $h x = f (g (h x)) It is also useful in higher-order situations, such as map ($ 0) xs, or zipWith ($) fs xs. Note that ($) is levity-polymorphic in its result type, so that foo $True where foo :: Bool -> Int# is well-typed. fromIntegral :: (Integral a, Num b) => a -> b # general coercion from integral types realToFrac :: (Real a, Fractional b) => a -> b # general coercion to fractional types 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  Since: base-2.1 Instance detailsDefined in Data.Semigroup.Internal Methods Since: base-2.1 Instance detailsDefined in Data.Semigroup.Internal Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methods Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methods Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methods Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methods Since: base-2.1 Instance detailsDefined in GHC.Int Methods Since: base-2.1 Instance detailsDefined in GHC.Int Methods Since: base-2.1 Instance detailsDefined in GHC.Int Methods Since: base-2.1 Instance detailsDefined in GHC.Int Methods Since: base-2.1 Instance detailsDefined in GHC.Word Methods Since: base-2.1 Instance detailsDefined in GHC.Word Methods Since: base-2.1 Instance detailsDefined in GHC.Word Methods Since: base-2.1 Instance detailsDefined in GHC.Word Methods Instance detailsDefined in GHC.LanguageExtensions.Type Methods Since: base-2.1 Instance detailsDefined in GHC.Enum Methods Bounded FailOn Instance detailsDefined in Test.Hspec.Core.Config.Definition MethodsminBound :: FailOn #maxBound :: FailOn # Bounded () Since: base-2.1 Instance detailsDefined in GHC.Enum MethodsminBound :: () #maxBound :: () # Since: base-2.1 Instance detailsDefined in GHC.Enum Methods Since: base-2.1 Instance detailsDefined in GHC.Enum Methods Since: base-2.1 Instance detailsDefined in GHC.Enum Methods Since: base-4.16.0.0 Instance detailsDefined in GHC.Enum Methods Since: base-4.10.0.0 Instance detailsDefined in GHC.Enum Methods Since: base-4.10.0.0 Instance detailsDefined in GHC.Enum Methods Since: base-2.1 Instance detailsDefined in GHC.Enum Methods Bounded a => Bounded (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity Methods Bounded a => Bounded (Dual a) Since: base-2.1 Instance detailsDefined in Data.Semigroup.Internal Methods Bounded a => Bounded (Product a) Since: base-2.1 Instance detailsDefined in Data.Semigroup.Internal Methods Bounded a => Bounded (Sum a) Since: base-2.1 Instance detailsDefined in Data.Semigroup.Internal MethodsminBound :: Sum a #maxBound :: Sum a # (Num a, Bounded a) => Bounded (NonNegative a) Since: smallcheck-1.2.0 Instance detailsDefined in Test.SmallCheck.Series Methods (Eq a, Num a, Bounded a) => Bounded (NonZero a) Instance detailsDefined in Test.SmallCheck.Series Methods (Num a, Bounded a) => Bounded (Positive a) Since: smallcheck-1.2.0 Instance detailsDefined in Test.SmallCheck.Series Methods Bounded a => Bounded (a) Instance detailsDefined in GHC.Enum MethodsminBound :: (a) #maxBound :: (a) # Bounded (Proxy t) Since: base-4.7.0.0 Instance detailsDefined in Data.Proxy Methods (Bounded a, Bounded b) => Bounded (a, b) Since: base-2.1 Instance detailsDefined in GHC.Enum MethodsminBound :: (a, b) #maxBound :: (a, b) # Bounded a => Bounded (Const a b) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const MethodsminBound :: Const a b #maxBound :: Const a b # (Applicative f, Bounded a) => Bounded (Ap f a) Since: base-4.12.0.0 Instance detailsDefined in Data.Monoid MethodsminBound :: Ap f a #maxBound :: Ap f a # a ~ b => Bounded (a :~: b) Since: base-4.7.0.0 Instance detailsDefined in Data.Type.Equality MethodsminBound :: a :~: b #maxBound :: a :~: b # (Bounded a, Bounded b, Bounded c) => Bounded (a, b, c) Since: base-2.1 Instance detailsDefined in GHC.Enum MethodsminBound :: (a, b, c) #maxBound :: (a, b, c) # a ~~ b => Bounded (a :~~: b) Since: base-4.10.0.0 Instance detailsDefined in Data.Type.Equality MethodsminBound :: a :~~: b #maxBound :: a :~~: b # (Bounded a, Bounded b, Bounded c, Bounded d) => Bounded (a, b, c, d) Since: base-2.1 Instance detailsDefined in GHC.Enum MethodsminBound :: (a, b, c, d) #maxBound :: (a, b, c, d) # (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e) => Bounded (a, b, c, d, e) Since: base-2.1 Instance detailsDefined in GHC.Enum MethodsminBound :: (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.1 Instance detailsDefined in GHC.Enum MethodsminBound :: (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.1 Instance detailsDefined in GHC.Enum MethodsminBound :: (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.1 Instance detailsDefined in GHC.Enum MethodsminBound :: (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.1 Instance detailsDefined in GHC.Enum MethodsminBound :: (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.1 Instance detailsDefined in GHC.Enum MethodsminBound :: (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.1 Instance detailsDefined in GHC.Enum MethodsminBound :: (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.1 Instance detailsDefined in GHC.Enum MethodsminBound :: (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.1 Instance detailsDefined in GHC.Enum MethodsminBound :: (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.1 Instance detailsDefined in GHC.Enum MethodsminBound :: (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.1 Instance detailsDefined in GHC.Enum MethodsminBound :: (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) # 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: • 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 Minimal complete definition Methods succ :: a -> a # the successor of a value. For numeric types, succ adds 1. pred :: a -> a # the 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). For example: • 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 For example: • 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 = []. For example: • 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 = [] For example: • enumFromThenTo 4 2 -6 :: [Integer] = [4,2,0,-2,-4,-6] • enumFromThenTo 6 8 2 :: [Int] = [] #### Instances Instances details  Instance detailsDefined in Foreign.C.Types Methodssucc :: CBool -> CBool #pred :: CBool -> CBool #toEnum :: Int -> CBool #enumFrom :: CBool -> [CBool] #enumFromThen :: CBool -> CBool -> [CBool] #enumFromTo :: CBool -> CBool -> [CBool] #enumFromThenTo :: CBool -> CBool -> CBool -> [CBool] # Instance detailsDefined in Foreign.C.Types Methodssucc :: CChar -> CChar #pred :: CChar -> CChar #toEnum :: Int -> CChar #enumFrom :: CChar -> [CChar] #enumFromThen :: CChar -> CChar -> [CChar] #enumFromTo :: CChar -> CChar -> [CChar] #enumFromThenTo :: CChar -> CChar -> CChar -> [CChar] # Instance detailsDefined in Foreign.C.Types MethodstoEnum :: Int -> CClock #enumFrom :: CClock -> [CClock] #enumFromThen :: CClock -> CClock -> [CClock] #enumFromTo :: CClock -> CClock -> [CClock] #enumFromThenTo :: CClock -> CClock -> CClock -> [CClock] # Instance detailsDefined in Foreign.C.Types MethodsenumFrom :: CDouble -> [CDouble] #enumFromThen :: CDouble -> CDouble -> [CDouble] #enumFromTo :: CDouble -> CDouble -> [CDouble] #enumFromThenTo :: CDouble -> CDouble -> CDouble -> [CDouble] # Instance detailsDefined in Foreign.C.Types MethodstoEnum :: Int -> CFloat #enumFrom :: CFloat -> [CFloat] #enumFromThen :: CFloat -> CFloat -> [CFloat] #enumFromTo :: CFloat -> CFloat -> [CFloat] #enumFromThenTo :: CFloat -> CFloat -> CFloat -> [CFloat] # Instance detailsDefined in Foreign.C.Types Methodssucc :: CInt -> CInt #pred :: CInt -> CInt #toEnum :: Int -> CInt #fromEnum :: CInt -> Int #enumFrom :: CInt -> [CInt] #enumFromThen :: CInt -> CInt -> [CInt] #enumFromTo :: CInt -> CInt -> [CInt] #enumFromThenTo :: CInt -> CInt -> CInt -> [CInt] # Instance detailsDefined in Foreign.C.Types MethodsenumFrom :: CIntMax -> [CIntMax] #enumFromThen :: CIntMax -> CIntMax -> [CIntMax] #enumFromTo :: CIntMax -> CIntMax -> [CIntMax] #enumFromThenTo :: CIntMax -> CIntMax -> CIntMax -> [CIntMax] # Instance detailsDefined in Foreign.C.Types MethodsenumFrom :: CIntPtr -> [CIntPtr] #enumFromThen :: CIntPtr -> CIntPtr -> [CIntPtr] #enumFromTo :: CIntPtr -> CIntPtr -> [CIntPtr] #enumFromThenTo :: CIntPtr -> CIntPtr -> CIntPtr -> [CIntPtr] # Instance detailsDefined in Foreign.C.Types MethodstoEnum :: Int -> CLLong #enumFrom :: CLLong -> [CLLong] #enumFromThen :: CLLong -> CLLong -> [CLLong] #enumFromTo :: CLLong -> CLLong -> [CLLong] #enumFromThenTo :: CLLong -> CLLong -> CLLong -> [CLLong] # Instance detailsDefined in Foreign.C.Types Methodssucc :: CLong -> CLong #pred :: CLong -> CLong #toEnum :: Int -> CLong #enumFrom :: CLong -> [CLong] #enumFromThen :: CLong -> CLong -> [CLong] #enumFromTo :: CLong -> CLong -> [CLong] #enumFromThenTo :: CLong -> CLong -> CLong -> [CLong] # Instance detailsDefined in Foreign.C.Types MethodsenumFrom :: CPtrdiff -> [CPtrdiff] #enumFromTo :: CPtrdiff -> CPtrdiff -> [CPtrdiff] # Instance detailsDefined in Foreign.C.Types MethodstoEnum :: Int -> CSChar #enumFrom :: CSChar -> [CSChar] #enumFromThen :: CSChar -> CSChar -> [CSChar] #enumFromTo :: CSChar -> CSChar -> [CSChar] #enumFromThenTo :: CSChar -> CSChar -> CSChar -> [CSChar] # Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types MethodstoEnum :: Int -> CShort #enumFrom :: CShort -> [CShort] #enumFromThen :: CShort -> CShort -> [CShort] #enumFromTo :: CShort -> CShort -> [CShort] #enumFromThenTo :: CShort -> CShort -> CShort -> [CShort] # Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methodssucc :: CSize -> CSize #pred :: CSize -> CSize #toEnum :: Int -> CSize #enumFrom :: CSize -> [CSize] #enumFromThen :: CSize -> CSize -> [CSize] #enumFromTo :: CSize -> CSize -> [CSize] #enumFromThenTo :: CSize -> CSize -> CSize -> [CSize] # Instance detailsDefined in Foreign.C.Types Methodssucc :: CTime -> CTime #pred :: CTime -> CTime #toEnum :: Int -> CTime #enumFrom :: CTime -> [CTime] #enumFromThen :: CTime -> CTime -> [CTime] #enumFromTo :: CTime -> CTime -> [CTime] #enumFromThenTo :: CTime -> CTime -> CTime -> [CTime] # Instance detailsDefined in Foreign.C.Types MethodstoEnum :: Int -> CUChar #enumFrom :: CUChar -> [CUChar] #enumFromThen :: CUChar -> CUChar -> [CUChar] #enumFromTo :: CUChar -> CUChar -> [CUChar] #enumFromThenTo :: CUChar -> CUChar -> CUChar -> [CUChar] # Instance detailsDefined in Foreign.C.Types Methodssucc :: CUInt -> CUInt #pred :: CUInt -> CUInt #toEnum :: Int -> CUInt #enumFrom :: CUInt -> [CUInt] #enumFromThen :: CUInt -> CUInt -> [CUInt] #enumFromTo :: CUInt -> CUInt -> [CUInt] #enumFromThenTo :: CUInt -> CUInt -> CUInt -> [CUInt] # Instance detailsDefined in Foreign.C.Types MethodsenumFrom :: CUIntMax -> [CUIntMax] #enumFromTo :: CUIntMax -> CUIntMax -> [CUIntMax] # Instance detailsDefined in Foreign.C.Types MethodsenumFrom :: CUIntPtr -> [CUIntPtr] #enumFromTo :: CUIntPtr -> CUIntPtr -> [CUIntPtr] # Instance detailsDefined in Foreign.C.Types MethodsenumFrom :: CULLong -> [CULLong] #enumFromThen :: CULLong -> CULLong -> [CULLong] #enumFromTo :: CULLong -> CULLong -> [CULLong] #enumFromThenTo :: CULLong -> CULLong -> CULLong -> [CULLong] # Instance detailsDefined in Foreign.C.Types MethodstoEnum :: Int -> CULong #enumFrom :: CULong -> [CULong] #enumFromThen :: CULong -> CULong -> [CULong] #enumFromTo :: CULong -> CULong -> [CULong] #enumFromThenTo :: CULong -> CULong -> CULong -> [CULong] # Instance detailsDefined in Foreign.C.Types MethodsenumFrom :: CUSeconds -> [CUSeconds] # Instance detailsDefined in Foreign.C.Types MethodsenumFrom :: CUShort -> [CUShort] #enumFromThen :: CUShort -> CUShort -> [CUShort] #enumFromTo :: CUShort -> CUShort -> [CUShort] #enumFromThenTo :: CUShort -> CUShort -> CUShort -> [CUShort] # Instance detailsDefined in Foreign.C.Types MethodstoEnum :: Int -> CWchar #enumFrom :: CWchar -> [CWchar] #enumFromThen :: CWchar -> CWchar -> [CWchar] #enumFromTo :: CWchar -> CWchar -> [CWchar] #enumFromThenTo :: CWchar -> CWchar -> CWchar -> [CWchar] # Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methods Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methods Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methods Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methods Since: base-2.1 Instance detailsDefined in GHC.Int Methodssucc :: Int16 -> Int16 #pred :: Int16 -> Int16 #toEnum :: Int -> Int16 #enumFrom :: Int16 -> [Int16] #enumFromThen :: Int16 -> Int16 -> [Int16] #enumFromTo :: Int16 -> Int16 -> [Int16] #enumFromThenTo :: Int16 -> Int16 -> Int16 -> [Int16] # Since: base-2.1 Instance detailsDefined in GHC.Int Methodssucc :: Int32 -> Int32 #pred :: Int32 -> Int32 #toEnum :: Int -> Int32 #enumFrom :: Int32 -> [Int32] #enumFromThen :: Int32 -> Int32 -> [Int32] #enumFromTo :: Int32 -> Int32 -> [Int32] #enumFromThenTo :: Int32 -> Int32 -> Int32 -> [Int32] # Since: base-2.1 Instance detailsDefined in GHC.Int Methodssucc :: Int64 -> Int64 #pred :: Int64 -> Int64 #toEnum :: Int -> Int64 #enumFrom :: Int64 -> [Int64] #enumFromThen :: Int64 -> Int64 -> [Int64] #enumFromTo :: Int64 -> Int64 -> [Int64] #enumFromThenTo :: Int64 -> Int64 -> Int64 -> [Int64] # Since: base-2.1 Instance detailsDefined in GHC.Int Methodssucc :: 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] # Since: base-2.1 Instance detailsDefined in GHC.Word MethodstoEnum :: Int -> Word16 #enumFrom :: Word16 -> [Word16] #enumFromThen :: Word16 -> Word16 -> [Word16] #enumFromTo :: Word16 -> Word16 -> [Word16] #enumFromThenTo :: Word16 -> Word16 -> Word16 -> [Word16] # Since: base-2.1 Instance detailsDefined in GHC.Word MethodstoEnum :: Int -> Word32 #enumFrom :: Word32 -> [Word32] #enumFromThen :: Word32 -> Word32 -> [Word32] #enumFromTo :: Word32 -> Word32 -> [Word32] #enumFromThenTo :: Word32 -> Word32 -> Word32 -> [Word32] # Since: base-2.1 Instance detailsDefined in GHC.Word MethodstoEnum :: Int -> Word64 #enumFrom :: Word64 -> [Word64] #enumFromThen :: Word64 -> Word64 -> [Word64] #enumFromTo :: Word64 -> Word64 -> [Word64] #enumFromThenTo :: Word64 -> Word64 -> Word64 -> [Word64] # Since: base-2.1 Instance detailsDefined in GHC.Word Methodssucc :: Word8 -> Word8 #pred :: Word8 -> Word8 #toEnum :: Int -> Word8 #enumFrom :: Word8 -> [Word8] #enumFromThen :: Word8 -> Word8 -> [Word8] #enumFromTo :: Word8 -> Word8 -> [Word8] #enumFromThenTo :: Word8 -> Word8 -> Word8 -> [Word8] # Instance detailsDefined in GHC.LanguageExtensions.Type MethodsenumFrom :: Extension -> [Extension] # Since: base-2.1 Instance detailsDefined in GHC.Enum MethodsenumFrom :: Ordering -> [Ordering] #enumFromTo :: Ordering -> Ordering -> [Ordering] # Enum FailOn Instance detailsDefined in Test.Hspec.Core.Config.Definition Methodssucc :: FailOn -> FailOn #pred :: FailOn -> FailOn #toEnum :: Int -> FailOn #fromEnum :: FailOn -> Int #enumFrom :: FailOn -> [FailOn] #enumFromThen :: FailOn -> FailOn -> [FailOn] #enumFromTo :: FailOn -> FailOn -> [FailOn] #enumFromThenTo :: FailOn -> FailOn -> FailOn -> [FailOn] # Instance detailsDefined in Test.SmallCheck.Property Methods Instance detailsDefined in Data.Time.Calendar.Days Methodssucc :: Day -> Day #pred :: Day -> Day #toEnum :: Int -> Day #fromEnum :: Day -> Int #enumFrom :: Day -> [Day] #enumFromThen :: Day -> Day -> [Day] #enumFromTo :: Day -> Day -> [Day] #enumFromThenTo :: Day -> Day -> Day -> [Day] # Since: base-2.1 Instance detailsDefined in GHC.Enum MethodsenumFrom :: Integer -> [Integer] #enumFromThen :: Integer -> Integer -> [Integer] #enumFromTo :: Integer -> Integer -> [Integer] #enumFromThenTo :: Integer -> Integer -> Integer -> [Integer] # Since: base-4.8.0.0 Instance detailsDefined in GHC.Enum MethodsenumFrom :: Natural -> [Natural] #enumFromThen :: Natural -> Natural -> [Natural] #enumFromTo :: Natural -> Natural -> [Natural] #enumFromThenTo :: Natural -> Natural -> Natural -> [Natural] # Enum () Since: base-2.1 Instance detailsDefined in GHC.Enum Methodssucc :: () -> () #pred :: () -> () #toEnum :: Int -> () #fromEnum :: () -> Int #enumFrom :: () -> [()] #enumFromThen :: () -> () -> [()] #enumFromTo :: () -> () -> [()] #enumFromThenTo :: () -> () -> () -> [()] # Since: base-2.1 Instance detailsDefined in GHC.Enum Methodssucc :: 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] # Since: base-2.1 Instance detailsDefined in GHC.Enum Methodssucc :: 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] # Since: base-2.1 Instance detailsDefined in GHC.Enum Methodssucc :: 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] # Since: base-4.16.0.0 Instance detailsDefined in GHC.Enum MethodstoEnum :: Int -> Levity #enumFrom :: Levity -> [Levity] #enumFromThen :: Levity -> Levity -> [Levity] #enumFromTo :: Levity -> Levity -> [Levity] #enumFromThenTo :: Levity -> Levity -> Levity -> [Levity] # Since: base-4.10.0.0 Instance detailsDefined in GHC.Enum MethodsenumFrom :: VecCount -> [VecCount] #enumFromTo :: VecCount -> VecCount -> [VecCount] # Since: base-4.10.0.0 Instance detailsDefined in GHC.Enum MethodsenumFrom :: VecElem -> [VecElem] #enumFromThen :: VecElem -> VecElem -> [VecElem] #enumFromTo :: VecElem -> VecElem -> [VecElem] #enumFromThenTo :: VecElem -> VecElem -> VecElem -> [VecElem] # Since: base-2.1 Instance detailsDefined in GHC.Enum Methodssucc :: 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 (Blind a) Instance detailsDefined in Test.QuickCheck.Modifiers Methodssucc :: Blind a -> Blind a #pred :: Blind a -> Blind a #toEnum :: Int -> Blind a #fromEnum :: Blind a -> Int #enumFrom :: Blind a -> [Blind a] #enumFromThen :: Blind a -> Blind a -> [Blind a] #enumFromTo :: Blind a -> Blind a -> [Blind a] #enumFromThenTo :: Blind a -> Blind a -> Blind a -> [Blind a] # Enum a => Enum (Fixed a) Instance detailsDefined in Test.QuickCheck.Modifiers Methodssucc :: 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 a => Enum (Large a) Instance detailsDefined in Test.QuickCheck.Modifiers Methodssucc :: Large a -> Large a #pred :: Large a -> Large a #toEnum :: Int -> Large a #fromEnum :: Large a -> Int #enumFrom :: Large a -> [Large a] #enumFromThen :: Large a -> Large a -> [Large a] #enumFromTo :: Large a -> Large a -> [Large a] #enumFromThenTo :: Large a -> Large a -> Large a -> [Large a] # Enum a => Enum (Negative a) Instance detailsDefined in Test.QuickCheck.Modifiers Methodssucc :: Negative a -> Negative a #pred :: Negative a -> Negative a #toEnum :: Int -> Negative a #fromEnum :: Negative a -> Int #enumFrom :: Negative a -> [Negative a] #enumFromThen :: Negative a -> Negative a -> [Negative a] #enumFromTo :: Negative a -> Negative a -> [Negative a] #enumFromThenTo :: Negative a -> Negative a -> Negative a -> [Negative a] # Enum a => Enum (NonNegative a) Instance detailsDefined in Test.QuickCheck.Modifiers Methodssucc :: NonNegative a -> NonNegative a #pred :: NonNegative a -> NonNegative a #fromEnum :: NonNegative a -> Int #enumFrom :: NonNegative a -> [NonNegative a] #enumFromThen :: NonNegative a -> NonNegative a -> [NonNegative a] #enumFromTo :: NonNegative a -> NonNegative a -> [NonNegative a] #enumFromThenTo :: NonNegative a -> NonNegative a -> NonNegative a -> [NonNegative a] # Enum a => Enum (NonPositive a) Instance detailsDefined in Test.QuickCheck.Modifiers Methodssucc :: NonPositive a -> NonPositive a #pred :: NonPositive a -> NonPositive a #fromEnum :: NonPositive a -> Int #enumFrom :: NonPositive a -> [NonPositive a] #enumFromThen :: NonPositive a -> NonPositive a -> [NonPositive a] #enumFromTo :: NonPositive a -> NonPositive a -> [NonPositive a] #enumFromThenTo :: NonPositive a -> NonPositive a -> NonPositive a -> [NonPositive a] # Enum a => Enum (NonZero a) Instance detailsDefined in Test.QuickCheck.Modifiers Methodssucc :: NonZero a -> NonZero a #pred :: NonZero a -> NonZero a #toEnum :: Int -> NonZero a #fromEnum :: NonZero a -> Int #enumFrom :: NonZero a -> [NonZero a] #enumFromThen :: NonZero a -> NonZero a -> [NonZero a] #enumFromTo :: NonZero a -> NonZero a -> [NonZero a] #enumFromThenTo :: NonZero a -> NonZero a -> NonZero a -> [NonZero a] # Enum a => Enum (Positive a) Instance detailsDefined in Test.QuickCheck.Modifiers Methodssucc :: Positive a -> Positive a #pred :: Positive a -> Positive a #toEnum :: Int -> Positive a #fromEnum :: Positive a -> Int #enumFrom :: Positive a -> [Positive a] #enumFromThen :: Positive a -> Positive a -> [Positive a] #enumFromTo :: Positive a -> Positive a -> [Positive a] #enumFromThenTo :: Positive a -> Positive a -> Positive a -> [Positive a] # Enum a => Enum (Shrink2 a) Instance detailsDefined in Test.QuickCheck.Modifiers Methodssucc :: Shrink2 a -> Shrink2 a #pred :: Shrink2 a -> Shrink2 a #toEnum :: Int -> Shrink2 a #fromEnum :: Shrink2 a -> Int #enumFrom :: Shrink2 a -> [Shrink2 a] #enumFromThen :: Shrink2 a -> Shrink2 a -> [Shrink2 a] #enumFromTo :: Shrink2 a -> Shrink2 a -> [Shrink2 a] #enumFromThenTo :: Shrink2 a -> Shrink2 a -> Shrink2 a -> [Shrink2 a] # Enum a => Enum (Small a) Instance detailsDefined in Test.QuickCheck.Modifiers Methodssucc :: Small a -> Small a #pred :: Small a -> Small a #toEnum :: Int -> Small a #fromEnum :: Small a -> Int #enumFrom :: Small a -> [Small a] #enumFromThen :: Small a -> Small a -> [Small a] #enumFromTo :: Small a -> Small a -> [Small a] #enumFromThenTo :: Small a -> Small a -> Small a -> [Small a] # Enum a => Enum (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity Methodssucc :: Identity a -> Identity a #pred :: Identity a -> Identity a #toEnum :: Int -> Identity a #fromEnum :: Identity a -> Int #enumFrom :: Identity a -> [Identity a] #enumFromThen :: Identity a -> Identity a -> [Identity a] #enumFromTo :: Identity a -> Identity a -> [Identity a] #enumFromThenTo :: Identity a -> Identity a -> Identity a -> [Identity a] # Integral a => Enum (Ratio a) Since: base-2.0.1 Instance detailsDefined in GHC.Real Methodssucc :: 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 (M a) Instance detailsDefined in Test.SmallCheck.Series Methodssucc :: M a -> M a #pred :: M a -> M a #toEnum :: Int -> M a #fromEnum :: M a -> Int #enumFrom :: M a -> [M a] #enumFromThen :: M a -> M a -> [M a] #enumFromTo :: M a -> M a -> [M a] #enumFromThenTo :: M a -> M a -> M a -> [M a] # Enum a => Enum (N a) Instance detailsDefined in Test.SmallCheck.Series Methodssucc :: N a -> N a #pred :: N a -> N a #toEnum :: Int -> N a #fromEnum :: N a -> Int #enumFrom :: N a -> [N a] #enumFromThen :: N a -> N a -> [N a] #enumFromTo :: N a -> N a -> [N a] #enumFromThenTo :: N a -> N a -> N a -> [N a] # Enum a => Enum (NonNegative a) Instance detailsDefined in Test.SmallCheck.Series Methodssucc :: NonNegative a -> NonNegative a #pred :: NonNegative a -> NonNegative a #fromEnum :: NonNegative a -> Int #enumFrom :: NonNegative a -> [NonNegative a] #enumFromThen :: NonNegative a -> NonNegative a -> [NonNegative a] #enumFromTo :: NonNegative a -> NonNegative a -> [NonNegative a] #enumFromThenTo :: NonNegative a -> NonNegative a -> NonNegative a -> [NonNegative a] # Enum a => Enum (NonZero a) Instance detailsDefined in Test.SmallCheck.Series Methodssucc :: NonZero a -> NonZero a #pred :: NonZero a -> NonZero a #toEnum :: Int -> NonZero a #fromEnum :: NonZero a -> Int #enumFrom :: NonZero a -> [NonZero a] #enumFromThen :: NonZero a -> NonZero a -> [NonZero a] #enumFromTo :: NonZero a -> NonZero a -> [NonZero a] #enumFromThenTo :: NonZero a -> NonZero a -> NonZero a -> [NonZero a] # Enum a => Enum (Positive a) Instance detailsDefined in Test.SmallCheck.Series Methodssucc :: Positive a -> Positive a #pred :: Positive a -> Positive a #toEnum :: Int -> Positive a #fromEnum :: Positive a -> Int #enumFrom :: Positive a -> [Positive a] #enumFromThen :: Positive a -> Positive a -> [Positive a] #enumFromTo :: Positive a -> Positive a -> [Positive a] #enumFromThenTo :: Positive a -> Positive a -> Positive a -> [Positive a] # Enum a => Enum (a) Instance detailsDefined in GHC.Enum Methodssucc :: (a) -> (a) #pred :: (a) -> (a) #toEnum :: Int -> (a) #fromEnum :: (a) -> Int #enumFrom :: (a) -> [(a)] #enumFromThen :: (a) -> (a) -> [(a)] #enumFromTo :: (a) -> (a) -> [(a)] #enumFromThenTo :: (a) -> (a) -> (a) -> [(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) == 1.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 detailsDefined in Data.Fixed Methodssucc :: 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 detailsDefined in Data.Proxy Methodssucc :: 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 detailsDefined in Data.Functor.Const Methodssucc :: 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 detailsDefined in Data.Monoid Methodssucc :: 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 detailsDefined in Data.Semigroup.Internal Methodssucc :: 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] # a ~ b => Enum (a :~: b) Since: base-4.7.0.0 Instance detailsDefined in Data.Type.Equality Methodssucc :: (a :~: b) -> a :~: b #pred :: (a :~: b) -> a :~: b #toEnum :: Int -> a :~: b #fromEnum :: (a :~: b) -> Int #enumFrom :: (a :~: b) -> [a :~: b] #enumFromThen :: (a :~: b) -> (a :~: b) -> [a :~: b] #enumFromTo :: (a :~: b) -> (a :~: b) -> [a :~: b] #enumFromThenTo :: (a :~: b) -> (a :~: b) -> (a :~: b) -> [a :~: b] # a ~~ b => Enum (a :~~: b) Since: base-4.10.0.0 Instance detailsDefined in Data.Type.Equality Methodssucc :: (a :~~: b) -> a :~~: b #pred :: (a :~~: b) -> a :~~: b #toEnum :: Int -> a :~~: b #fromEnum :: (a :~~: b) -> Int #enumFrom :: (a :~~: b) -> [a :~~: b] #enumFromThen :: (a :~~: b) -> (a :~~: b) -> [a :~~: b] #enumFromTo :: (a :~~: b) -> (a :~~: b) -> [a :~~: b] #enumFromThenTo :: (a :~~: b) -> (a :~~: b) -> (a :~~: b) -> [a :~~: b] # class Applicative m => Monad (m :: Type -> Type) where # The Monad class defines the basic operations over a monad, a concept from a branch of mathematics known as category theory. From the perspective of a Haskell programmer, however, it is best to think of a monad as an abstract datatype of actions. Haskell's do expressions provide a convenient syntax for writing monadic expressions. Instances of Monad should satisfy the following: Left identity return a >>= k = k a Right identity m >>= return = m Associativity m >>= (\x -> k x >>= h) = (m >>= k) >>= h Furthermore, the Monad and Applicative operations should relate as follows: • pure = return • m1 <*> m2 = m1 >>= (x1 -> m2 >>= (x2 -> return (x1 x2))) The above laws imply: • fmap f xs = xs >>= return . f • (>>) = (*>) and that pure and (<*>) satisfy the applicative functor laws. The instances of Monad for lists, Maybe and IO defined in the Prelude satisfy these laws. Minimal complete definition (>>=) Methods (>>=) :: m a -> (a -> m b) -> m b infixl 1 # Sequentially compose two actions, passing any value produced by the first as an argument to the second. 'as >>= bs' can be understood as the do expression do a <- as bs a  (>>) :: m a -> m b -> m b infixl 1 # Sequentially compose two actions, discarding any value produced by the first, like sequencing operators (such as the semicolon) in imperative languages. 'as >> bs' can be understood as the do expression do as bs  return :: a -> m a # Inject a value into the monadic type. #### Instances Instances details  Instance detailsDefined in Test.QuickCheck.Gen Methods(>>=) :: Gen a -> (a -> Gen b) -> Gen b #(>>) :: Gen a -> Gen b -> Gen b #return :: a -> Gen a # Monad Rose Instance detailsDefined in Test.QuickCheck.Property Methods(>>=) :: Rose a -> (a -> Rose b) -> Rose b #(>>) :: Rose a -> Rose b -> Rose b #return :: a -> Rose a # Since: base-4.9.0.0 Instance detailsDefined in Data.Complex Methods(>>=) :: Complex a -> (a -> Complex b) -> Complex b #(>>) :: Complex a -> Complex b -> Complex b #return :: a -> Complex a # Since: base-4.8.0.0 Instance detailsDefined in Data.Functor.Identity Methods(>>=) :: Identity a -> (a -> Identity b) -> Identity b #(>>) :: Identity a -> Identity b -> Identity b #return :: a -> Identity a # Since: base-4.8.0.0 Instance detailsDefined in Data.Monoid Methods(>>=) :: First a -> (a -> First b) -> First b #(>>) :: First a -> First b -> First b #return :: a -> First a # Since: base-4.8.0.0 Instance detailsDefined in Data.Monoid Methods(>>=) :: Last a -> (a -> Last b) -> Last b #(>>) :: Last a -> Last b -> Last b #return :: a -> Last a # Since: base-4.8.0.0 Instance detailsDefined in Data.Semigroup.Internal Methods(>>=) :: Dual a -> (a -> Dual b) -> Dual b #(>>) :: Dual a -> Dual b -> Dual b #return :: a -> Dual a # Since: base-4.8.0.0 Instance detailsDefined in Data.Semigroup.Internal Methods(>>=) :: Product a -> (a -> Product b) -> Product b #(>>) :: Product a -> Product b -> Product b #return :: a -> Product a # Since: base-4.8.0.0 Instance detailsDefined in Data.Semigroup.Internal Methods(>>=) :: Sum a -> (a -> Sum b) -> Sum b #(>>) :: Sum a -> Sum b -> Sum b #return :: a -> Sum a # Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methods(>>=) :: Par1 a -> (a -> Par1 b) -> Par1 b #(>>) :: Par1 a -> Par1 b -> Par1 b #return :: a -> Par1 a # Since: base-2.1 Instance detailsDefined in Text.ParserCombinators.ReadP Methods(>>=) :: P a -> (a -> P b) -> P b #(>>) :: P a -> P b -> P b #return :: a -> P a # Since: base-2.1 Instance detailsDefined in Text.ParserCombinators.ReadP Methods(>>=) :: ReadP a -> (a -> ReadP b) -> ReadP b #(>>) :: ReadP a -> ReadP b -> ReadP b #return :: a -> ReadP a # Since: base-2.1 Instance detailsDefined in Text.ParserCombinators.ReadPrec Methods(>>=) :: ReadPrec a -> (a -> ReadPrec b) -> ReadPrec b #(>>) :: ReadPrec a -> ReadPrec b -> ReadPrec b #return :: a -> ReadPrec a # Instance detailsDefined in Data.Sequence.Internal Methods(>>=) :: Seq a -> (a -> Seq b) -> Seq b #(>>) :: Seq a -> Seq b -> Seq b #return :: a -> Seq a # Instance detailsDefined in Data.Tree Methods(>>=) :: Tree a -> (a -> Tree b) -> Tree b #(>>) :: Tree a -> Tree b -> Tree b #return :: a -> Tree a # Since: base-2.1 Instance detailsDefined in GHC.Base Methods(>>=) :: IO a -> (a -> IO b) -> IO b #(>>) :: IO a -> IO b -> IO b #return :: a -> IO a # Instance detailsDefined in Language.Haskell.TH.Syntax Methods(>>=) :: Q a -> (a -> Q b) -> Q b #(>>) :: Q a -> Q b -> Q b #return :: a -> Q a # Since: base-4.9.0.0 Instance detailsDefined in GHC.Base Methods(>>=) :: NonEmpty a -> (a -> NonEmpty b) -> NonEmpty b #(>>) :: NonEmpty a -> NonEmpty b -> NonEmpty b #return :: a -> NonEmpty a # Since: base-2.1 Instance detailsDefined in GHC.Base Methods(>>=) :: Maybe a -> (a -> Maybe b) -> Maybe b #(>>) :: Maybe a -> Maybe b -> Maybe b #return :: a -> Maybe a # Since: base-4.15 Instance detailsDefined in GHC.Base Methods(>>=) :: Solo a -> (a -> Solo b) -> Solo b #(>>) :: Solo a -> Solo b -> Solo b #return :: a -> Solo a # Monad [] Since: base-2.1 Instance detailsDefined in GHC.Base Methods(>>=) :: [a] -> (a -> [b]) -> [b] #(>>) :: [a] -> [b] -> [b] #return :: a -> [a] # Monad m => Monad (WrappedMonad m) Since: base-4.7.0.0 Instance detailsDefined in Control.Applicative Methods(>>=) :: WrappedMonad m a -> (a -> WrappedMonad m b) -> WrappedMonad m b #(>>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b #return :: a -> WrappedMonad m a # Monad (Either e) Since: base-4.4.0.0 Instance detailsDefined in Data.Either Methods(>>=) :: Either e a -> (a -> Either e b) -> Either e b #(>>) :: Either e a -> Either e b -> Either e b #return :: a -> Either e a # Monad (Proxy :: Type -> Type) Since: base-4.7.0.0 Instance detailsDefined in Data.Proxy Methods(>>=) :: Proxy a -> (a -> Proxy b) -> Proxy b #(>>) :: Proxy a -> Proxy b -> Proxy b #return :: a -> Proxy a # Monad (U1 :: Type -> Type) Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methods(>>=) :: U1 a -> (a -> U1 b) -> U1 b #(>>) :: U1 a -> U1 b -> U1 b #return :: a -> U1 a # Monoid es => Monad (CollectErrors es) Instance detailsDefined in Control.CollectErrors.Type Methods(>>=) :: CollectErrors es a -> (a -> CollectErrors es b) -> CollectErrors es b #(>>) :: CollectErrors es a -> CollectErrors es b -> CollectErrors es b #return :: a -> CollectErrors es a # Monad (SpecM a) Instance detailsDefined in Test.Hspec.Core.Spec.Monad Methods(>>=) :: SpecM a a0 -> (a0 -> SpecM a b) -> SpecM a b #(>>) :: SpecM a a0 -> SpecM a b -> SpecM a b #return :: a0 -> SpecM a a0 # Monoid a => Monad ((,) a) Since: base-4.9.0.0 Instance detailsDefined in GHC.Base Methods(>>=) :: (a, a0) -> (a0 -> (a, b)) -> (a, b) #(>>) :: (a, a0) -> (a, b) -> (a, b) #return :: a0 -> (a, a0) # Monad f => Monad (Ap f) Since: base-4.12.0.0 Instance detailsDefined in Data.Monoid Methods(>>=) :: Ap f a -> (a -> Ap f b) -> Ap f b #(>>) :: Ap f a -> Ap f b -> Ap f b #return :: a -> Ap f a # Monad f => Monad (Alt f) Since: base-4.8.0.0 Instance detailsDefined in Data.Semigroup.Internal Methods(>>=) :: Alt f a -> (a -> Alt f b) -> Alt f b #(>>) :: Alt f a -> Alt f b -> Alt f b #return :: a -> Alt f a # Monad f => Monad (Rec1 f) Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methods(>>=) :: Rec1 f a -> (a -> Rec1 f b) -> Rec1 f b #(>>) :: Rec1 f a -> Rec1 f b -> Rec1 f b #return :: a -> Rec1 f a # (Applicative f, Monad f) => Monad (WhenMissing f x) Equivalent to ReaderT k (ReaderT x (MaybeT f)).Since: containers-0.5.9 Instance detailsDefined in Data.IntMap.Internal Methods(>>=) :: WhenMissing f x a -> (a -> WhenMissing f x b) -> WhenMissing f x b #(>>) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x b #return :: a -> WhenMissing f x a # (Monad m, Error e) => Monad (ErrorT e m) Instance detailsDefined in Control.Monad.Trans.Error Methods(>>=) :: ErrorT e m a -> (a -> ErrorT e m b) -> ErrorT e m b #(>>) :: ErrorT e m a -> ErrorT e m b -> ErrorT e m b #return :: a -> ErrorT e m a # Monad m => Monad (ReaderT r m) Instance detailsDefined in Control.Monad.Trans.Reader Methods(>>=) :: ReaderT r m a -> (a -> ReaderT r m b) -> ReaderT r m b #(>>) :: ReaderT r m a -> ReaderT r m b -> ReaderT r m b #return :: a -> ReaderT r m a # (Monoid w, Monad m) => Monad (WriterT w m) Instance detailsDefined in Control.Monad.Trans.Writer.Lazy Methods(>>=) :: WriterT w m a -> (a -> WriterT w m b) -> WriterT w m b #(>>) :: WriterT w m a -> WriterT w m b -> WriterT w m b #return :: a -> WriterT w m a # (Monoid a, Monoid b) => Monad ((,,) a b) Since: base-4.14.0.0 Instance detailsDefined in GHC.Base Methods(>>=) :: (a, b, a0) -> (a0 -> (a, b, b0)) -> (a, b, b0) #(>>) :: (a, b, a0) -> (a, b, b0) -> (a, b, b0) #return :: a0 -> (a, b, a0) # (Monad f, Monad g) => Monad (Product f g) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Product Methods(>>=) :: Product f g a -> (a -> Product f g b) -> Product f g b #(>>) :: Product f g a -> Product f g b -> Product f g b #return :: a -> Product f g a # (Monad f, Monad g) => Monad (f :*: g) Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methods(>>=) :: (f :*: g) a -> (a -> (f :*: g) b) -> (f :*: g) b #(>>) :: (f :*: g) a -> (f :*: g) b -> (f :*: g) b #return :: a -> (f :*: g) a # (Monad f, Applicative f) => Monad (WhenMatched f x y) Equivalent to ReaderT Key (ReaderT x (ReaderT y (MaybeT f)))Since: containers-0.5.9 Instance detailsDefined in Data.IntMap.Internal Methods(>>=) :: WhenMatched f x y a -> (a -> WhenMatched f x y b) -> WhenMatched f x y b #(>>) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y b #return :: a -> WhenMatched f x y a # (Applicative f, Monad f) => Monad (WhenMissing f k x) Equivalent to  ReaderT k (ReaderT x (MaybeT f)) .Since: containers-0.5.9 Instance detailsDefined in Data.Map.Internal Methods(>>=) :: WhenMissing f k x a -> (a -> WhenMissing f k x b) -> WhenMissing f k x b #(>>) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x b #return :: a -> WhenMissing f k x a # (Monoid a, Monoid b, Monoid c) => Monad ((,,,) a b c) Since: base-4.14.0.0 Instance detailsDefined in GHC.Base Methods(>>=) :: (a, b, c, a0) -> (a0 -> (a, b, c, b0)) -> (a, b, c, b0) #(>>) :: (a, b, c, a0) -> (a, b, c, b0) -> (a, b, c, b0) #return :: a0 -> (a, b, c, a0) # Monad ((->) r) Since: base-2.1 Instance detailsDefined in GHC.Base Methods(>>=) :: (r -> a) -> (a -> r -> b) -> r -> b #(>>) :: (r -> a) -> (r -> b) -> r -> b #return :: a -> r -> a # Monad f => Monad (M1 i c f) Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methods(>>=) :: M1 i c f a -> (a -> M1 i c f b) -> M1 i c f b #(>>) :: M1 i c f a -> M1 i c f b -> M1 i c f b #return :: a -> M1 i c f a # (Monad f, Applicative f) => Monad (WhenMatched f k x y) Equivalent to  ReaderT k (ReaderT x (ReaderT y (MaybeT f))) Since: containers-0.5.9 Instance detailsDefined in Data.Map.Internal Methods(>>=) :: WhenMatched f k x y a -> (a -> WhenMatched f k x y b) -> WhenMatched f k x y b #(>>) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y b #return :: a -> WhenMatched f k x y a # class Functor (f :: Type -> Type) where # A type f is a Functor if it provides a function fmap which, given any types a and b lets you apply any function from (a -> b) to turn an f a into an f b, preserving the structure of f. Furthermore f needs to adhere to the following: Identity fmap id == id Composition fmap (f . g) == fmap f . fmap g Note, that the second law follows from the free theorem of the type fmap and the first law, so you need only check that the former condition holds. Minimal complete definition fmap Methods fmap :: (a -> b) -> f a -> f b # fmap is used to apply a function of type (a -> b) to a value of type f a, where f is a functor, to produce a value of type f b. Note that for any type constructor with more than one parameter (e.g., Either), only the last type parameter can be modified with fmap (e.g., b in Either a b). Some type constructors with two parameters or more have a Bifunctor instance that allows both the last and the penultimate parameters to be mapped over. #### Examples Expand Convert from a Maybe Int to a Maybe String using show: >>> fmap show Nothing Nothing >>> fmap show (Just 3) Just "3"  Convert from an Either Int Int to an Either Int String using show: >>> fmap show (Left 17) Left 17 >>> fmap show (Right 17) Right "17"  Double each element of a list: >>> fmap (*2) [1,2,3] [2,4,6]  Apply even to the second element of a pair: >>> fmap even (2,2) (2,True)  It may seem surprising that the function is only applied to the last element of the tuple compared to the list example above which applies it to every element in the list. To understand, remember that tuples are type constructors with multiple type parameters: a tuple of 3 elements (a,b,c) can also be written (,,) a b c and its Functor instance is defined for Functor ((,,) a b) (i.e., only the third parameter is free to be mapped over with fmap). It explains why fmap can be used with tuples containing values of different types as in the following example: >>> fmap even ("hello", 1.0, 4) ("hello",1.0,True)  (<$) :: a -> f b -> f a infixl 4 #

Replace all locations in the input with the same value. The default definition is fmap . const, but this may be overridden with a more efficient version.

#### Instances

Instances details
 Instance detailsDefined in Test.QuickCheck.Gen Methodsfmap :: (a -> b) -> Gen a -> Gen b #(<$) :: a -> Gen b -> Gen a # Instance detailsDefined in Test.QuickCheck.Modifiers Methodsfmap :: (a -> b) -> Blind a -> Blind b #(<$) :: a -> Blind b -> Blind a # Instance detailsDefined in Test.QuickCheck.Modifiers Methodsfmap :: (a -> b) -> Fixed a -> Fixed b #(<$) :: a -> Fixed b -> Fixed a # Instance detailsDefined in Test.QuickCheck.Modifiers Methodsfmap :: (a -> b) -> Large a -> Large b #(<$) :: a -> Large b -> Large a # Instance detailsDefined in Test.QuickCheck.Modifiers Methodsfmap :: (a -> b) -> Negative a -> Negative b #(<$) :: a -> Negative b -> Negative a # Instance detailsDefined in Test.QuickCheck.Modifiers Methodsfmap :: (a -> b) -> NonEmptyList a -> NonEmptyList b #(<$) :: a -> NonEmptyList b -> NonEmptyList a # Instance detailsDefined in Test.QuickCheck.Modifiers Methodsfmap :: (a -> b) -> NonNegative a -> NonNegative b #(<$) :: a -> NonNegative b -> NonNegative a # Instance detailsDefined in Test.QuickCheck.Modifiers Methodsfmap :: (a -> b) -> NonPositive a -> NonPositive b #(<$) :: a -> NonPositive b -> NonPositive a # Instance detailsDefined in Test.QuickCheck.Modifiers Methodsfmap :: (a -> b) -> NonZero a -> NonZero b #(<$) :: a -> NonZero b -> NonZero a # Instance detailsDefined in Test.QuickCheck.Modifiers Methodsfmap :: (a -> b) -> OrderedList a -> OrderedList b #(<$) :: a -> OrderedList b -> OrderedList a # Instance detailsDefined in Test.QuickCheck.Modifiers Methodsfmap :: (a -> b) -> Positive a -> Positive b #(<$) :: a -> Positive b -> Positive a # Instance detailsDefined in Test.QuickCheck.Modifiers Methodsfmap :: (a -> b) -> Shrink2 a -> Shrink2 b #(<$) :: a -> Shrink2 b -> Shrink2 a # Instance detailsDefined in Test.QuickCheck.Modifiers Methodsfmap :: (a -> b) -> Small a -> Small b #(<$) :: a -> Small b -> Small a # Instance detailsDefined in Test.QuickCheck.Modifiers Methodsfmap :: (a -> b) -> Smart a -> Smart b #(<$) :: a -> Smart b -> Smart a # Instance detailsDefined in Test.QuickCheck.Modifiers Methodsfmap :: (a -> b) -> SortedList a -> SortedList b #(<$) :: a -> SortedList b -> SortedList a # Functor Rose Instance detailsDefined in Test.QuickCheck.Property Methodsfmap :: (a -> b) -> Rose a -> Rose b #(<$) :: a -> Rose b -> Rose a # Since: base-2.1 Instance detailsDefined in Control.Applicative Methodsfmap :: (a -> b) -> ZipList a -> ZipList b #(<$) :: a -> ZipList b -> ZipList a # Since: base-4.6.0.0 Instance detailsDefined in Control.Exception Methodsfmap :: (a -> b) -> Handler a -> Handler b #(<$) :: a -> Handler b -> Handler a # Since: base-4.9.0.0 Instance detailsDefined in Data.Complex Methodsfmap :: (a -> b) -> Complex a -> Complex b #(<$) :: a -> Complex b -> Complex a # Since: base-4.8.0.0 Instance detailsDefined in Data.Functor.Identity Methodsfmap :: (a -> b) -> Identity a -> Identity b #(<$) :: a -> Identity b -> Identity a # Since: base-4.8.0.0 Instance detailsDefined in Data.Monoid Methodsfmap :: (a -> b) -> First a -> First b #(<$) :: a -> First b -> First a # Since: base-4.8.0.0 Instance detailsDefined in Data.Monoid Methodsfmap :: (a -> b) -> Last a -> Last b #(<$) :: a -> Last b -> Last a # Since: base-4.8.0.0 Instance detailsDefined in Data.Semigroup.Internal Methodsfmap :: (a -> b) -> Dual a -> Dual b #(<$) :: a -> Dual b -> Dual a # Since: base-4.8.0.0 Instance detailsDefined in Data.Semigroup.Internal Methodsfmap :: (a -> b) -> Product a -> Product b #(<$) :: a -> Product b -> Product a # Since: base-4.8.0.0 Instance detailsDefined in Data.Semigroup.Internal Methodsfmap :: (a -> b) -> Sum a -> Sum b #(<$) :: a -> Sum b -> Sum a # Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodsfmap :: (a -> b) -> Par1 a -> Par1 b #(<$) :: a -> Par1 b -> Par1 a # Since: base-4.8.0.0 Instance detailsDefined in Text.ParserCombinators.ReadP Methodsfmap :: (a -> b) -> P a -> P b #(<$) :: a -> P b -> P a # Since: base-2.1 Instance detailsDefined in Text.ParserCombinators.ReadP Methodsfmap :: (a -> b) -> ReadP a -> ReadP b #(<$) :: a -> ReadP b -> ReadP a # Since: base-2.1 Instance detailsDefined in Text.ParserCombinators.ReadPrec Methodsfmap :: (a -> b) -> ReadPrec a -> ReadPrec b #(<$) :: a -> ReadPrec b -> ReadPrec a # Instance detailsDefined in Data.IntMap.Internal Methodsfmap :: (a -> b) -> IntMap a -> IntMap b #(<$) :: a -> IntMap b -> IntMap a # Instance detailsDefined in Data.Sequence.Internal Methodsfmap :: (a -> b) -> Digit a -> Digit b #(<$) :: a -> Digit b -> Digit a # Instance detailsDefined in Data.Sequence.Internal Methodsfmap :: (a -> b) -> Elem a -> Elem b #(<$) :: a -> Elem b -> Elem a # Instance detailsDefined in Data.Sequence.Internal Methodsfmap :: (a -> b) -> FingerTree a -> FingerTree b #(<$) :: a -> FingerTree b -> FingerTree a # Instance detailsDefined in Data.Sequence.Internal Methodsfmap :: (a -> b) -> Node a -> Node b #(<$) :: a -> Node b -> Node a # Instance detailsDefined in Data.Sequence.Internal Methodsfmap :: (a -> b) -> Seq a -> Seq b #(<$) :: a -> Seq b -> Seq a # Instance detailsDefined in Data.Sequence.Internal Methodsfmap :: (a -> b) -> ViewL a -> ViewL b #(<$) :: a -> ViewL b -> ViewL a # Instance detailsDefined in Data.Sequence.Internal Methodsfmap :: (a -> b) -> ViewR a -> ViewR b #(<$) :: a -> ViewR b -> ViewR a # Instance detailsDefined in Data.Tree Methodsfmap :: (a -> b) -> Tree a -> Tree b #(<$) :: a -> Tree b -> Tree a # Since: base-2.1 Instance detailsDefined in GHC.Base Methodsfmap :: (a -> b) -> IO a -> IO b #(<$) :: a -> IO b -> IO a # Since: smallcheck-1.2.0 Instance detailsDefined in Test.SmallCheck.Series Methodsfmap :: (a -> b) -> NonNegative a -> NonNegative b #(<$) :: a -> NonNegative b -> NonNegative a # Instance detailsDefined in Test.SmallCheck.Series Methodsfmap :: (a -> b) -> NonZero a -> NonZero b #(<$) :: a -> NonZero b -> NonZero a # Since: smallcheck-1.2.0 Instance detailsDefined in Test.SmallCheck.Series Methodsfmap :: (a -> b) -> Positive a -> Positive b #(<$) :: a -> Positive b -> Positive a # Instance detailsDefined in Language.Haskell.TH.Syntax Methodsfmap :: (a -> b) -> Q a -> Q b #(<$) :: a -> Q b -> Q a # Instance detailsDefined in Language.Haskell.TH.Syntax Methodsfmap :: (a -> b) -> TyVarBndr a -> TyVarBndr b #(<$) :: a -> TyVarBndr b -> TyVarBndr a # Since: base-4.9.0.0 Instance detailsDefined in GHC.Base Methodsfmap :: (a -> b) -> NonEmpty a -> NonEmpty b #(<$) :: a -> NonEmpty b -> NonEmpty a # Since: base-2.1 Instance detailsDefined in GHC.Base Methodsfmap :: (a -> b) -> Maybe a -> Maybe b #(<$) :: a -> Maybe b -> Maybe a # Since: base-4.15 Instance detailsDefined in GHC.Base Methodsfmap :: (a -> b) -> Solo a -> Solo b #(<$) :: a -> Solo b -> Solo a # Functor [] Since: base-2.1 Instance detailsDefined in GHC.Base Methodsfmap :: (a -> b) -> [a] -> [b] #(<$) :: a -> [b] -> [a] # Functor ((:->) a) Instance detailsDefined in Test.QuickCheck.Function Methodsfmap :: (a0 -> b) -> (a :-> a0) -> a :-> b #(<$) :: a0 -> (a :-> b) -> a :-> a0 # Functor (Fun a) Instance detailsDefined in Test.QuickCheck.Function Methodsfmap :: (a0 -> b) -> Fun a a0 -> Fun a b #(<$) :: a0 -> Fun a b -> Fun a a0 # Instance detailsDefined in Test.QuickCheck.Modifiers Methodsfmap :: (a -> b) -> Shrinking s a -> Shrinking s b #(<$) :: a -> Shrinking s b -> Shrinking s a # Monad m => Functor (WrappedMonad m) Since: base-2.1 Instance detailsDefined in Control.Applicative Methodsfmap :: (a -> b) -> WrappedMonad m a -> WrappedMonad m b #(<$) :: a -> WrappedMonad m b -> WrappedMonad m a # Since: base-3.0 Instance detailsDefined in Data.Either Methodsfmap :: (a0 -> b) -> Either a a0 -> Either a b #(<$) :: a0 -> Either a b -> Either a a0 # Functor (Proxy :: Type -> Type) Since: base-4.7.0.0 Instance detailsDefined in Data.Proxy Methodsfmap :: (a -> b) -> Proxy a -> Proxy b #(<$) :: a -> Proxy b -> Proxy a # Functor (U1 :: Type -> Type) Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodsfmap :: (a -> b) -> U1 a -> U1 b #(<$) :: a -> U1 b -> U1 a # Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodsfmap :: (a -> b) -> V1 a -> V1 b #(<$) :: a -> V1 b -> V1 a # Instance detailsDefined in Control.CollectErrors.Type Methodsfmap :: (a -> b) -> CollectErrors es a -> CollectErrors es b #(<$) :: a -> CollectErrors es b -> CollectErrors es a # Functor (Map k) Instance detailsDefined in Data.Map.Internal Methodsfmap :: (a -> b) -> Map k a -> Map k b #(<$) :: a -> Map k b -> Map k a # Functor (SpecM a) Instance detailsDefined in Test.Hspec.Core.Spec.Monad Methodsfmap :: (a0 -> b) -> SpecM a a0 -> SpecM a b #(<$) :: a0 -> SpecM a b -> SpecM a a0 # Functor (Tree c) Instance detailsDefined in Test.Hspec.Core.Tree Methodsfmap :: (a -> b) -> Tree c a -> Tree c b #(<$) :: a -> Tree c b -> Tree c a # Functor ((,) a) Since: base-2.1 Instance detailsDefined in GHC.Base Methodsfmap :: (a0 -> b) -> (a, a0) -> (a, b) #(<$) :: a0 -> (a, b) -> (a, a0) # Arrow a => Functor (WrappedArrow a b) Since: base-2.1 Instance detailsDefined in Control.Applicative Methodsfmap :: (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 #(<$) :: a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 # Functor (Const m :: Type -> Type) Since: base-2.1 Instance detailsDefined in Data.Functor.Const Methodsfmap :: (a -> b) -> Const m a -> Const m b #(<$) :: a -> Const m b -> Const m a # Functor f => Functor (Ap f) Since: base-4.12.0.0 Instance detailsDefined in Data.Monoid Methodsfmap :: (a -> b) -> Ap f a -> Ap f b #(<$) :: a -> Ap f b -> Ap f a # Functor f => Functor (Alt f) Since: base-4.8.0.0 Instance detailsDefined in Data.Semigroup.Internal Methodsfmap :: (a -> b) -> Alt f a -> Alt f b #(<$) :: a -> Alt f b -> Alt f a # Functor f => Functor (Rec1 f) Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodsfmap :: (a -> b) -> Rec1 f a -> Rec1 f b #(<$) :: a -> Rec1 f b -> Rec1 f a # Functor (URec (Ptr ()) :: TYPE LiftedRep -> Type) Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodsfmap :: (a -> b) -> URec (Ptr ()) a -> URec (Ptr ()) b #(<$) :: a -> URec (Ptr ()) b -> URec (Ptr ()) a # Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodsfmap :: (a -> b) -> URec Char a -> URec Char b #(<$) :: a -> URec Char b -> URec Char a # Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodsfmap :: (a -> b) -> URec Double a -> URec Double b #(<$) :: a -> URec Double b -> URec Double a # Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodsfmap :: (a -> b) -> URec Float a -> URec Float b #(<$) :: a -> URec Float b -> URec Float a # Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodsfmap :: (a -> b) -> URec Int a -> URec Int b #(<$) :: a -> URec Int b -> URec Int a # Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodsfmap :: (a -> b) -> URec Word a -> URec Word b #(<$) :: a -> URec Word b -> URec Word a # (Applicative f, Monad f) => Functor (WhenMissing f x) Since: containers-0.5.9 Instance detailsDefined in Data.IntMap.Internal Methodsfmap :: (a -> b) -> WhenMissing f x a -> WhenMissing f x b #(<$) :: a -> WhenMissing f x b -> WhenMissing f x a # Functor m => Functor (ErrorT e m) Instance detailsDefined in Control.Monad.Trans.Error Methodsfmap :: (a -> b) -> ErrorT e m a -> ErrorT e m b #(<$) :: a -> ErrorT e m b -> ErrorT e m a # Functor m => Functor (ReaderT r m) Instance detailsDefined in Control.Monad.Trans.Reader Methodsfmap :: (a -> b) -> ReaderT r m a -> ReaderT r m b #(<$) :: a -> ReaderT r m b -> ReaderT r m a # Functor m => Functor (WriterT w m) Instance detailsDefined in Control.Monad.Trans.Writer.Lazy Methodsfmap :: (a -> b) -> WriterT w m a -> WriterT w m b #(<$) :: a -> WriterT w m b -> WriterT w m a # Functor (Constant a :: Type -> Type) Instance detailsDefined in Data.Functor.Constant Methodsfmap :: (a0 -> b) -> Constant a a0 -> Constant a b #(<$) :: a0 -> Constant a b -> Constant a a0 # Functor ((,,) a b) Since: base-4.14.0.0 Instance detailsDefined in GHC.Base Methodsfmap :: (a0 -> b0) -> (a, b, a0) -> (a, b, b0) #(<$) :: a0 -> (a, b, b0) -> (a, b, a0) # (Functor f, Functor g) => Functor (Product f g) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Product Methodsfmap :: (a -> b) -> Product f g a -> Product f g b #(<$) :: a -> Product f g b -> Product f g a # (Functor f, Functor g) => Functor (f :*: g) Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodsfmap :: (a -> b) -> (f :*: g) a -> (f :*: g) b #(<$) :: a -> (f :*: g) b -> (f :*: g) a # (Functor f, Functor g) => Functor (f :+: g) Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodsfmap :: (a -> b) -> (f :+: g) a -> (f :+: g) b #(<$) :: a -> (f :+: g) b -> (f :+: g) a # Functor (K1 i c :: TYPE LiftedRep -> Type) Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodsfmap :: (a -> b) -> K1 i c a -> K1 i c b #(<$) :: a -> K1 i c b -> K1 i c a # Functor f => Functor (WhenMatched f x y) Since: containers-0.5.9 Instance detailsDefined in Data.IntMap.Internal Methodsfmap :: (a -> b) -> WhenMatched f x y a -> WhenMatched f x y b #(<$) :: a -> WhenMatched f x y b -> WhenMatched f x y a # (Applicative f, Monad f) => Functor (WhenMissing f k x) Since: containers-0.5.9 Instance detailsDefined in Data.Map.Internal Methodsfmap :: (a -> b) -> WhenMissing f k x a -> WhenMissing f k x b #(<$) :: a -> WhenMissing f k x b -> WhenMissing f k x a # Functor ((,,,) a b c) Since: base-4.14.0.0 Instance detailsDefined in GHC.Base Methodsfmap :: (a0 -> b0) -> (a, b, c, a0) -> (a, b, c, b0) #(<$) :: a0 -> (a, b, c, b0) -> (a, b, c, a0) # Functor ((->) r) Since: base-2.1 Instance detailsDefined in GHC.Base Methodsfmap :: (a -> b) -> (r -> a) -> r -> b #(<$) :: a -> (r -> b) -> r -> a # (Functor f, Functor g) => Functor (Compose f g) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Compose Methodsfmap :: (a -> b) -> Compose f g a -> Compose f g b #(<$) :: a -> Compose f g b -> Compose f g a # (Functor f, Functor g) => Functor (f :.: g) Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodsfmap :: (a -> b) -> (f :.: g) a -> (f :.: g) b #(<$) :: a -> (f :.: g) b -> (f :.: g) a # Functor f => Functor (M1 i c f) Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodsfmap :: (a -> b) -> M1 i c f a -> M1 i c f b #(<$) :: a -> M1 i c f b -> M1 i c f a # Functor f => Functor (WhenMatched f k x y) Since: containers-0.5.9 Instance detailsDefined in Data.Map.Internal Methodsfmap :: (a -> b) -> WhenMatched f k x y a -> WhenMatched f k x y b #(<$) :: a -> WhenMatched f k x y b -> WhenMatched f k x y a #

Parsing of Strings, producing values.

Derived instances of Read make the following assumptions, which derived instances of Show obey:

• If the constructor is defined to be an infix operator, then the derived Read instance will parse only infix applications of the constructor (not the prefix form).
• Associativity is not used to reduce the occurrence of parentheses, although precedence may be.
• If the constructor is defined using record syntax, the derived Read will parse only the record-syntax form, and furthermore, the fields must be given in the same order as the original declaration.
• The derived Read instance allows arbitrary Haskell whitespace between tokens of the input string. Extra parentheses are also allowed.

For example, given the declarations

infixr 5 :^:
data Tree a =  Leaf a  |  Tree a :^: Tree a

the derived instance of Read in Haskell 2010 is equivalent to

instance (Read a) => Read (Tree a) where

(\r -> [(Leaf m,t) |
("Leaf",s) <- lex r,
(m,t) <- readsPrec (app_prec+1) s]) r

(\r -> [(u:^:v,w) |
(":^:",t) <- lex s,
(v,w) <- readsPrec (up_prec+1) t]) r

where app_prec = 10
up_prec = 5

Note that right-associativity of :^: is unused.

The derived instance in GHC is equivalent to

instance (Read a) => Read (Tree a) where

readPrec = parens $(prec app_prec$ do
Ident "Leaf" <- lexP
return (Leaf m))

+++ (prec up_prec \$ do
Symbol ":^:" <- lexP
return (u :^: v))

where app_prec = 10
up_prec = 5

readListPrec = readListPrecDefault

Why do both readsPrec and readPrec exist, and why does GHC opt to implement readPrec in derived Read instances instead of readsPrec? The reason is that readsPrec is based on the ReadS type, and although ReadS is mentioned in the Haskell 2010 Report, it is not a very efficient parser data structure.

readPrec, on the other hand, is based on a much more efficient ReadPrec datatype (a.k.a "new-style parsers"), but its definition relies on the use of the RankNTypes language extension. Therefore, readPrec (and its cousin, readListPrec) are marked as GHC-only. Nevertheless, it is recommended to use readPrec instead of readsPrec whenever possible for the efficiency improvements it brings.

As mentioned above, derived Read instances in GHC will implement readPrec instead of readsPrec. The default implementations of readsPrec (and its cousin, readList) will simply use readPrec under the hood. If you are writing a Read instance by hand, it is recommended to write it like so:

instance Read T where
readPrec     = ...
readListPrec = readListPrecDefault


Minimal complete definition

Methods

Arguments

 :: Int the operator precedence of the enclosing context (a number from 0 to 11). Function application has precedence 10. -> ReadS a

attempts to parse a value from the front of the string, returning a list of (parsed value, remaining string) pairs. If there is no successful parse, the returned list is empty.

Derived instances of Read and Show satisfy the following:

• (x,"") is an element of (readsPrec d (showsPrec d x "")).

That is, readsPrec parses the string produced by showsPrec, and delivers the value that showsPrec started with.

The method readList is provided to allow the programmer to give a specialised way of parsing lists of values. For example, this is used by the predefined Read instance of the Char type, where values of type String should be are expected to use double quotes, rather than square brackets.

#### Instances

Instances details
 Instance detailsDefined in Test.QuickCheck.Modifiers Methods Instance detailsDefined in Test.QuickCheck.Modifiers Methods Instance detailsDefined in Test.QuickCheck.Modifiers Methods Read QCGen Instance detailsDefined in Test.QuickCheck.Random MethodsreadsPrec :: Int -> ReadS QCGen #readList :: ReadS [QCGen] #readPrec :: ReadPrec QCGen #readListPrec :: ReadPrec [QCGen] # Instance detailsDefined in Test.QuickCheck.Test Methods Since: base-2.1 Instance detailsDefined in Data.Semigroup.Internal Methods Since: base-2.1 Instance detailsDefined in Data.Semigroup.Internal Methods Since: base-2.1 Instance detailsDefined in Data.Version Methods Reading a Void value is always a parse error, considering Void as a data type with no constructors.Since: base-4.8.0.0 Instance detailsDefined in Data.Void Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Since: base-4.6.0.0 Instance detailsDefined in GHC.Generics Methods Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methods Since: base-4.6.0.0 Instance detailsDefined in GHC.Generics Methods Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methods Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methods Instance detailsDefined in GHC.IO.Exception Methods Since: base-4.2.0.0 Instance detailsDefined in GHC.IO.Handle.Types Methods Since: base-4.3.0.0 Instance detailsDefined in GHC.IO.Handle.Types Methods Since: base-4.3.0.0 Instance detailsDefined in GHC.IO.Handle.Types Methods Since: base-2.1 Instance detailsDefined in GHC.Int Methods Since: base-2.1 Instance detailsDefined in GHC.Int Methods Since: base-2.1 Instance detailsDefined in GHC.Int Methods Since: base-2.1 Instance detailsDefined in GHC.Int Methods Since: base-2.1 Instance detailsDefined in GHC.Read Methods Since: base-2.1 Instance detailsDefined in GHC.Read Methods Since: base-2.1 Instance detailsDefined in GHC.Read Methods Since: base-2.1 Instance detailsDefined in GHC.Read Methods Since: base-2.1 Instance detailsDefined in GHC.Read Methods Since: base-2.1 Instance detailsDefined in GHC.Read Methods Instance detailsDefined in Data.IntSet.Internal Methods Since: base-2.1 Instance detailsDefined in GHC.Read Methods Source # Instance detailsDefined in Data.Convertible.Base Methods Since: base-2.1 Instance detailsDefined in GHC.Read Methods Since: base-4.8.0.0 Instance detailsDefined in GHC.Read Methods Read () Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS () #readList :: ReadS [()] #readListPrec :: ReadPrec [()] # Since: base-2.1 Instance detailsDefined in GHC.Read Methods Since: base-2.1 Instance detailsDefined in GHC.Read Methods Since: base-2.1 Instance detailsDefined in GHC.Read Methods Since: base-2.1 Instance detailsDefined in GHC.Read Methods Since: base-2.1 Instance detailsDefined in GHC.Read Methods Since: base-4.5.0.0 Instance detailsDefined in GHC.Read Methods Read a => Read (Fixed a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodsreadsPrec :: Int -> ReadS (Fixed a) #readList :: ReadS [Fixed a] # Read a => Read (Large a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodsreadsPrec :: Int -> ReadS (Large a) #readList :: ReadS [Large a] # Read a => Read (Negative a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodsreadsPrec :: Int -> ReadS (Negative a) # Read a => Read (NonEmptyList a) Instance detailsDefined in Test.QuickCheck.Modifiers Methods Read a => Read (NonNegative a) Instance detailsDefined in Test.QuickCheck.Modifiers Methods Read a => Read (NonPositive a) Instance detailsDefined in Test.QuickCheck.Modifiers Methods Read a => Read (NonZero a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodsreadsPrec :: Int -> ReadS (NonZero a) # Read a => Read (OrderedList a) Instance detailsDefined in Test.QuickCheck.Modifiers Methods Read a => Read (Positive a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodsreadsPrec :: Int -> ReadS (Positive a) # Read a => Read (Shrink2 a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodsreadsPrec :: Int -> ReadS (Shrink2 a) # Read a => Read (Small a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodsreadsPrec :: Int -> ReadS (Small a) #readList :: ReadS [Small a] # Read a => Read (SortedList a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodsreadsPrec :: Int -> ReadS (SortedList a) # Read a => Read (ZipList a) Since: base-4.7.0.0 Instance detailsDefined in Control.Applicative MethodsreadsPrec :: Int -> ReadS (ZipList a) # Read a => Read (Complex a) Since: base-2.1 Instance detailsDefined in Data.Complex MethodsreadsPrec :: Int -> ReadS (Complex a) # Read a => Read (Identity a) This instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removedSince: base-4.8.0.0 Instance detailsDefined in Data.Functor.Identity MethodsreadsPrec :: Int -> ReadS (Identity a) # Read a => Read (First a) Since: base-2.1 Instance detailsDefined in Data.Monoid MethodsreadsPrec :: Int -> ReadS (First a) #readList :: ReadS [First a] # Read a => Read (Last a) Since: base-2.1 Instance detailsDefined in Data.Monoid MethodsreadsPrec :: Int -> ReadS (Last a) #readList :: ReadS [Last a] # Read a => Read (Dual a) Since: base-2.1 Instance detailsDefined in Data.Semigroup.Internal MethodsreadsPrec :: Int -> ReadS (Dual a) #readList :: ReadS [Dual a] # Read a => Read (Product a) Since: base-2.1 Instance detailsDefined in Data.Semigroup.Internal MethodsreadsPrec :: Int -> ReadS (Product a) # Read a => Read (Sum a) Since: base-2.1 Instance detailsDefined in Data.Semigroup.Internal MethodsreadsPrec :: Int -> ReadS (Sum a) #readList :: ReadS [Sum a] #readPrec :: ReadPrec (Sum a) # Read p => Read (Par1 p) Since: base-4.7.0.0 Instance detailsDefined in GHC.Generics MethodsreadsPrec :: Int -> ReadS (Par1 p) #readList :: ReadS [Par1 p] # (Integral a, Read a) => Read (Ratio a) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (Ratio a) #readList :: ReadS [Ratio a] # Read e => Read (IntMap e) Instance detailsDefined in Data.IntMap.Internal MethodsreadsPrec :: Int -> ReadS (IntMap e) #readList :: ReadS [IntMap e] # Read a => Read (Seq a) Instance detailsDefined in Data.Sequence.Internal MethodsreadsPrec :: Int -> ReadS (Seq a) #readList :: ReadS [Seq a] #readPrec :: ReadPrec (Seq a) # Read a => Read (ViewL a) Instance detailsDefined in Data.Sequence.Internal MethodsreadsPrec :: Int -> ReadS (ViewL a) #readList :: ReadS [ViewL a] # Read a => Read (ViewR a) Instance detailsDefined in Data.Sequence.Internal MethodsreadsPrec :: Int -> ReadS (ViewR a) #readList :: ReadS [ViewR a] # (Read a, Ord a) => Read (Set a) Instance detailsDefined in Data.Set.Internal MethodsreadsPrec :: Int -> ReadS (Set a) #readList :: ReadS [Set a] #readPrec :: ReadPrec (Set a) # Read a => Read (Tree a) Instance detailsDefined in Data.Tree MethodsreadsPrec :: Int -> ReadS (Tree a) #readList :: ReadS [Tree a] # Read a => Read (NonEmpty a) Since: base-4.11.0.0 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (NonEmpty a) # Read a => Read (Maybe a) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (Maybe a) #readList :: ReadS [Maybe a] # Read a => Read (a) Since: base-4.15 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (a) #readList :: ReadS [(a)] #readPrec :: ReadPrec (a) #readListPrec :: ReadPrec [(a)] # Read a => Read [a] Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS [a] #readList :: ReadS [[a]] #readPrec :: ReadPrec [a] #readListPrec :: ReadPrec [[a]] # (Read a, Read b) => Read (Either a b) Since: base-3.0 Instance detailsDefined in Data.Either MethodsreadsPrec :: Int -> ReadS (Either a b) #readList :: ReadS [Either a b] #readPrec :: ReadPrec (Either a b) #readListPrec :: ReadPrec [Either a b] # HasResolution a => Read (Fixed a) Since: base-4.3.0.0 Instance detailsDefined in Data.Fixed MethodsreadsPrec :: Int -> ReadS (Fixed a) #readList :: ReadS [Fixed a] # Read (Proxy t) Since: base-4.7.0.0 Instance detailsDefined in Data.Proxy MethodsreadsPrec :: Int -> ReadS (Proxy t) #readList :: ReadS [Proxy t] # (Ix a, Read a, Read b) => Read (Array a b) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (Array a b) #readList :: ReadS [Array a b] #readPrec :: ReadPrec (Array a b) #readListPrec :: ReadPrec [Array a b] # Read (U1 p) Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics MethodsreadsPrec :: Int -> ReadS (U1 p) #readList :: ReadS [U1 p] #readPrec :: ReadPrec (U1 p) # Read (V1 p) Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics MethodsreadsPrec :: Int -> ReadS (V1 p) #readList :: ReadS [V1 p] #readPrec :: ReadPrec (V1 p) # (Ord k, Read k, Read e) => Read (Map k e) Instance detailsDefined in Data.Map.Internal MethodsreadsPrec :: Int -> ReadS (Map k e) #readList :: ReadS [Map k e] #readPrec :: ReadPrec (Map k e) #readListPrec :: ReadPrec [Map k e] # (Read a, Read b) => Read (a, b) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (a, b) #readList :: ReadS [(a, b)] #readPrec :: ReadPrec (a, b) #readListPrec :: ReadPrec [(a, b)] # Read a => Read (Const a b) This instance would be equivalent to the derived instances of the Const newtype if the getConst field were removedSince: base-4.8.0.0 Instance detailsDefined in Data.Functor.Const MethodsreadsPrec :: Int -> ReadS (Const a b) #readList :: ReadS [Const a b] #readPrec :: ReadPrec (Const a b) #readListPrec :: ReadPrec [Const a b] # Read (f a) => Read (Ap f a) Since: base-4.12.0.0 Instance detailsDefined in Data.Monoid MethodsreadsPrec :: Int -> ReadS (Ap f a) #readList :: ReadS [Ap f a] #readPrec :: ReadPrec (Ap f a) #readListPrec :: ReadPrec [Ap f a] # Read (f a) => Read (Alt f a) Since: base-4.8.0.0 Instance detailsDefined in Data.Semigroup.Internal MethodsreadsPrec :: Int -> ReadS (Alt f a) #readList :: ReadS [Alt f a] #readPrec :: ReadPrec (Alt f a) #readListPrec :: ReadPrec [Alt f a] # a ~ b => Read (a :~: b) Since: base-4.7.0.0 Instance detailsDefined in Data.Type.Equality MethodsreadsPrec :: Int -> ReadS (a :~: b) #readList :: ReadS [a :~: b] #readPrec :: ReadPrec (a :~: b) #readListPrec :: ReadPrec [a :~: b] # Read (f p) => Read (Rec1 f p) Since: base-4.7.0.0 Instance detailsDefined in GHC.Generics MethodsreadsPrec :: Int -> ReadS (Rec1 f p) #readList :: ReadS [Rec1 f p] #readPrec :: ReadPrec (Rec1 f p) #readListPrec :: ReadPrec [Rec1 f p] # (Read e, Read1 m, Read a) => Read (ErrorT e m a) Instance detailsDefined in Control.Monad.Trans.Error MethodsreadsPrec :: Int -> ReadS (ErrorT e m a) #readList :: ReadS [ErrorT e m a] #readPrec :: ReadPrec (ErrorT e m a) #readListPrec :: ReadPrec [ErrorT e m a] # (Read w, Read1 m, Read a) => Read (WriterT w m a) Instance detailsDefined in Control.Monad.Trans.Writer.Lazy MethodsreadsPrec :: Int -> ReadS (WriterT w m a) #readList :: ReadS [WriterT w m a] #readPrec :: ReadPrec (WriterT w m a) #readListPrec :: ReadPrec [WriterT w m a] # Read a => Read (Constant a b) Instance detailsDefined in Data.Functor.Constant MethodsreadsPrec :: Int -> ReadS (Constant a b) #readList :: ReadS [Constant a b] #readPrec :: ReadPrec (Constant a b) # (Read a, Read b, Read c) => Read (a, b, c) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (a, b, c) #readList :: ReadS [(a, b, c)] #readPrec :: ReadPrec (a, b, c) #readListPrec :: ReadPrec [(a, b, c)] # (Read1 f, Read1 g, Read a) => Read (Product f g a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Product MethodsreadsPrec :: Int -> ReadS (Product f g a) #readList :: ReadS [Product f g a] #readPrec :: ReadPrec (Product f g a) #readListPrec :: ReadPrec [Product f g a] # a ~~ b => Read (a :~~: b) Since: base-4.10.0.0 Instance detailsDefined in Data.Type.Equality MethodsreadsPrec :: Int -> ReadS (a :~~: b) #readList :: ReadS [a :~~: b] #readPrec :: ReadPrec (a :~~: b) # (Read (f p), Read (g p)) => Read ((f :*: g) p) Since: base-4.7.0.0 Instance detailsDefined in GHC.Generics MethodsreadsPrec :: Int -> ReadS ((f :*: g) p) #readList :: ReadS [(f :*: g) p] #readPrec :: ReadPrec ((f :*: g) p) #readListPrec :: ReadPrec [(f :*: g) p] # (Read (f p), Read (g p)) => Read ((f :+: g) p) Since: base-4.7.0.0 Instance detailsDefined in GHC.Generics MethodsreadsPrec :: Int -> ReadS ((f :+: g) p) #readList :: ReadS [(f :+: g) p] #readPrec :: ReadPrec ((f :+: g) p) #readListPrec :: ReadPrec [(f :+: g) p] # Read c => Read (K1 i c p) Since: base-4.7.0.0 Instance detailsDefined in GHC.Generics MethodsreadsPrec :: Int -> ReadS (K1 i c p) #readList :: ReadS [K1 i c p] #readPrec :: ReadPrec (K1 i c p) #readListPrec :: ReadPrec [K1 i c p] # (Read a, Read b, Read c, Read d) => Read (a, b, c, d) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (a, b, c, d) #readList :: ReadS [(a, b, c, d)] #readPrec :: ReadPrec (a, b, c, d) #readListPrec :: ReadPrec [(a, b, c, d)] # (Read1 f, Read1 g, Read a) => Read (Compose f g a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Compose MethodsreadsPrec :: Int -> ReadS (Compose f g a) #readList :: ReadS [Compose f g a] #readPrec :: ReadPrec (Compose f g a) #readListPrec :: ReadPrec [Compose f g a] # Read (f (g p)) => Read ((f :.: g) p) Since: base-4.7.0.0 Instance detailsDefined in GHC.Generics MethodsreadsPrec :: Int -> ReadS ((f :.: g) p) #readList :: ReadS [(f :.: g) p] #readPrec :: ReadPrec ((f :.: g) p) #readListPrec :: ReadPrec [(f :.: g) p] # Read (f p) => Read (M1 i c f p) Since: base-4.7.0.0 Instance detailsDefined in GHC.Generics MethodsreadsPrec :: Int -> ReadS (M1 i c f p) #readList :: ReadS [M1 i c f p] #readPrec :: ReadPrec (M1 i c f p) #readListPrec :: ReadPrec [M1 i c f p] # (Read a, Read b, Read c, Read d, Read e) => Read (a, b, c, d, e) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (a, b, c, d, e) #readList :: ReadS [(a, b, c, d, e)] #readPrec :: ReadPrec (a, b, c, d, e) #readListPrec :: ReadPrec [(a, b, c, d, e)] # (Read a, Read b, Read c, Read d, Read e, Read f) => Read (a, b, c, d, e, f) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (a, b, c, d, e, f) #readList :: ReadS [(a, b, c, d, e, f)] #readPrec :: ReadPrec (a, b, c, d, e, f) #readListPrec :: ReadPrec [(a, b, c, d, e, f)] # (Read a, Read b, Read c, Read d, Read e, Read f, Read g) => Read (a, b, c, d, e, f, g) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (a, b, c, d, e, f, g) #readList :: ReadS [(a, b, c, d, e, f, g)] #readPrec :: ReadPrec (a, b, c, d, e, f, g) #readListPrec :: ReadPrec [(a, b, c, d, e, f, g)] # (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h) => Read (a, b, c, d, e, f, g, h) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (a, b, c, d, e, f, g, h) #readList :: ReadS [(a, b, c, d, e, f, g, h)] #readPrec :: ReadPrec (a, b, c, d, e, f, g, h) #readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h)] # (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i) => Read (a, b, c, d, e, f, g, h, i) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (a, b, c, d, e, f, g, h, i) #readList :: ReadS [(a, b, c, d, e, f, g, h, i)] #readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i) #readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i)] # (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j) => Read (a, b, c, d, e, f, g, h, i, j) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (a, b, c, d, e, f, g, h, i, j) #readList :: ReadS [(a, b, c, d, e, f, g, h, i, j)] #readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i, j) #readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j)] # (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j, Read k) => Read (a, b, c, d, e, f, g, h, i, j, k) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (a, b, c, d, e, f, g, h, i, j, k) #readList :: ReadS [(a, b, c, d, e, f, g, h, i, j, k)] #readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i, j, k) #readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j, k)] # (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j, Read k, Read l) => Read (a, b, c, d, e, f, g, h, i, j, k, l) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (a, b, c, d, e, f, g, h, i, j, k, l) #readList :: ReadS [(a, b, c, d, e, f, g, h, i, j, k, l)] #readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i, j, k, l) #readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j, k, l)] # (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j, Read k, Read l, Read m) => Read (a, b, c, d, e, f, g, h, i, j, k, l, m) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (a, b, c, d, e, f, g, h, i, j, k, l, m) #readList :: ReadS [(a, b, c, d, e, f, g, h, i, j, k, l, m)] #readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i, j, k, l, m) #readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j, k, l, m)] # (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j, Read k, Read l, Read m, Read n) => Read (a, b, c, d, e, f, g, h, i, j, k, l, m, n) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (a, b, c, d, e, f, g, h, i, j, k, l, m, n) #readList :: ReadS [(a, b, c, d, e, f, g, h, i, j, k, l, m, n)] #readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i, j, k, l, m, n) #readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j, k, l, m, n)] # (Read a, Read b, Read c, Read d, Read e, Read f, Read g, Read h, Read i, Read j, Read k, Read l, Read m, Read n, Read o) => Read (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) #readList :: ReadS [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)] #readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) #readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)] #

class (Num a, Ord a) => Real a where #

Methods

toRational :: a -> Rational #

the rational equivalent of its real argument with full precision

#### Instances

Instances details
 Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types Methods Since: base-2.1 Instance detailsDefined in GHC.Int Methods Since: base-2.1 Instance detailsDefined in GHC.Int Methods Since: base-2.1 Instance detailsDefined in GHC.Int Methods Since: base-2.1 Instance detailsDefined in GHC.Int Methods Since: base-2.1 Instance detailsDefined in GHC.Word Methods Since: base-2.1 Instance detailsDefined in GHC.Word Methods Since: base-2.1 Instance detailsDefined in GHC.Word Methods Since: base-2.1 Instance detailsDefined in GHC.Word Methods Since: base-2.0.1 Instance detailsDefined in GHC.Real Methods Since: base-4.8.0.0 Instance detailsDefined in GHC.Real Methods Since: base-2.0.1 Instance detailsDefined in GHC.Real Methods Since: base-2.1 Instance detailsDefined in GHC.Real Methods Real a => Real (Blind a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodstoRational :: Blind a -> Rational # Real a => Real (Fixed a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodstoRational :: Fixed a -> Rational # Real a => Real (Large a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodstoRational :: Large a -> Rational # Real a => Real (Shrink2 a) Instance detailsDefined in Test.QuickCheck.Modifiers Methods Real a => Real (Small a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodstoRational :: Small a -> Rational # Real a => Real (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity Methods Integral a => Real (Ratio a) Since: base-2.0.1 Instance detailsDefined in GHC.Real MethodstoRational :: Ratio a -> Rational # Real a => Real (M a) Instance detailsDefined in Test.SmallCheck.Series MethodstoRational :: M a -> Rational # Real a => Real (N a) Instance detailsDefined in Test.SmallCheck.Series MethodstoRational :: N a -> Rational # Real a => Real (NonNegative a) Instance detailsDefined in Test.SmallCheck.Series Methods Real a => Real (NonZero a) Instance detailsDefined in Test.SmallCheck.Series Methods Real a => Real (Positive a) Instance detailsDefined in Test.SmallCheck.Series Methods HasResolution a => Real (Fixed a) Since: base-2.1 Instance detailsDefined in Data.Fixed MethodstoRational :: Fixed a -> Rational # Real a => Real (Const a b) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Const MethodstoRational :: Const a b -> Rational #

class (RealFrac a, Floating a) => RealFloat a where #