mixed-types-num-0.5.9.1: Alternative Prelude with numeric and logic expressions typed bottom-up
Copyright (c) Michal Konecny BSD3 mikkonecny@gmail.com experimental portable Safe-Inferred Haskell2010

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 short, excess elements of the longer list are discarded:

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

zip is right-lazy:

zip [] _|_ = []
zip _|_ [] = _|_

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]


($) :: 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 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-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.Enum Methods Since: base-2.1 Instance detailsDefined in GHC.Enum 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-4.10.0.0 Instance detailsDefined in GHC.Enum Methods Since: base-4.10.0.0 Instance detailsDefined in GHC.Enum Methods Bounded () Since: base-2.1 Instance detailsDefined in GHC.Enum MethodsminBound :: () #maxBound :: () # Since: base-2.1 Instance detailsDefined in Data.Semigroup.Internal Methods Since: base-2.1 Instance detailsDefined in Data.Semigroup.Internal 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 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 GHC.LanguageExtensions.Type 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 (Sum a) Since: base-2.1 Instance detailsDefined in Data.Semigroup.Internal MethodsminBound :: Sum a #maxBound :: Sum a # Bounded a => Bounded (Product a) Since: base-2.1 Instance detailsDefined in Data.Semigroup.Internal Methods (Num a, Bounded a) => Bounded (Positive a) Instance detailsDefined in Test.SmallCheck.Series Methods (Num a, Bounded a) => Bounded (NonNegative a) Instance detailsDefined in Test.SmallCheck.Series Methods (Eq a, Num a, Bounded a) => Bounded (NonZero a) Instance detailsDefined in Test.SmallCheck.Series Methods (Bounded a, Bounded b) => Bounded (a, b) Since: base-2.1 Instance detailsDefined in GHC.Enum MethodsminBound :: (a, b) #maxBound :: (a, b) # Bounded (Proxy t) Since: base-4.7.0.0 Instance detailsDefined in Data.Proxy Methods (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) # 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 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) # 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 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  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-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.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.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] # Since: base-2.1 Instance detailsDefined in GHC.Enum MethodsenumFrom :: Ordering -> [Ordering] #enumFromTo :: Ordering -> Ordering -> [Ordering] # 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] # 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] # 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-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] # Enum () Since: base-2.1 Instance detailsDefined in GHC.Enum Methodssucc :: () -> () #pred :: () -> () #toEnum :: Int -> () #fromEnum :: () -> Int #enumFrom :: () -> [()] #enumFromThen :: () -> () -> [()] #enumFromTo :: () -> () -> [()] #enumFromThenTo :: () -> () -> () -> [()] # 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 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 -> CSChar #enumFrom :: CSChar -> [CSChar] #enumFromThen :: CSChar -> CSChar -> [CSChar] #enumFromTo :: CSChar -> CSChar -> [CSChar] #enumFromThenTo :: CSChar -> CSChar -> CSChar -> [CSChar] # 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 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 MethodsenumFrom :: CUShort -> [CUShort] #enumFromThen :: CUShort -> CUShort -> [CUShort] #enumFromTo :: CUShort -> CUShort -> [CUShort] #enumFromThenTo :: CUShort -> CUShort -> CUShort -> [CUShort] # 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 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 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 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 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 MethodsenumFrom :: CULLong -> [CULLong] #enumFromThen :: CULLong -> CULLong -> [CULLong] #enumFromTo :: CULLong -> CULLong -> [CULLong] #enumFromThenTo :: CULLong -> CULLong -> CULLong -> [CULLong] # 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 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 MethodsenumFrom :: CDouble -> [CDouble] #enumFromThen :: CDouble -> CDouble -> [CDouble] #enumFromTo :: CDouble -> CDouble -> [CDouble] #enumFromThenTo :: CDouble -> CDouble -> CDouble -> [CDouble] # Instance detailsDefined in Foreign.C.Types MethodsenumFrom :: CPtrdiff -> [CPtrdiff] #enumFromTo :: CPtrdiff -> CPtrdiff -> [CPtrdiff] # 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 MethodstoEnum :: Int -> CWchar #enumFrom :: CWchar -> [CWchar] #enumFromThen :: CWchar -> CWchar -> [CWchar] #enumFromTo :: CWchar -> CWchar -> [CWchar] #enumFromThenTo :: CWchar -> CWchar -> CWchar -> [CWchar] # Instance detailsDefined in Foreign.C.Types Methods 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 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 MethodsenumFrom :: CUSeconds -> [CUSeconds] # Instance detailsDefined in Foreign.C.Types Methods 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 MethodsenumFrom :: CUIntPtr -> [CUIntPtr] #enumFromTo :: CUIntPtr -> CUIntPtr -> [CUIntPtr] # 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 :: CUIntMax -> [CUIntMax] #enumFromTo :: CUIntMax -> CUIntMax -> [CUIntMax] # Instance detailsDefined in System.Clock Methodssucc :: Clock -> Clock #pred :: Clock -> Clock #toEnum :: Int -> Clock #enumFrom :: Clock -> [Clock] #enumFromThen :: Clock -> Clock -> [Clock] #enumFromTo :: Clock -> Clock -> [Clock] #enumFromThenTo :: Clock -> Clock -> Clock -> [Clock] # Instance detailsDefined in GHC.LanguageExtensions.Type MethodsenumFrom :: Extension -> [Extension] # 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] # 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 (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 (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 (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 (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 (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 (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 (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 (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 (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] # 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 (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 (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 (Fixed a) 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  Monad [] Since: base-2.1 Instance detailsDefined in GHC.Base Methods(>>=) :: [a] -> (a -> [b]) -> [b] #(>>) :: [a] -> [b] -> [b] #return :: a -> [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-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 # 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 # 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 # 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 # Instance detailsDefined in Test.QuickCheck.Gen Methods(>>=) :: Gen a -> (a -> Gen b) -> Gen b #(>>) :: Gen a -> Gen b -> Gen b #return :: a -> Gen 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(>>=) :: Sum a -> (a -> Sum b) -> Sum b #(>>) :: Sum a -> Sum b -> Sum b #return :: a -> Sum 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-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 # 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-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 # Instance detailsDefined in Data.Tree Methods(>>=) :: Tree a -> (a -> Tree b) -> Tree b #(>>) :: Tree a -> Tree b -> Tree b #return :: a -> Tree 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 # 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 # 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 (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 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 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 (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 # 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 # 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 # (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 (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 # (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 # Monad ((->) r :: Type -> Type) 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 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 # (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 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, 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 # 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 # Using ApplicativeDo: 'fmap f as' can be understood as the do expression do a <- as pure (f a)  with an inferred Functor constraint. (<$) :: 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.

Using ApplicativeDo: 'a <$bs' can be understood as the do expression do bs pure a  with an inferred Functor constraint. #### Instances Instances details  Functor [] Since: base-2.1 Instance detailsDefined in GHC.Base Methodsfmap :: (a -> b) -> [a] -> [b] #(<$) :: a -> [b] -> [a] # Since: base-2.1 Instance detailsDefined in GHC.Base Methodsfmap :: (a -> b) -> Maybe a -> Maybe b #(<$) :: a -> Maybe b -> Maybe a # Since: base-2.1 Instance detailsDefined in GHC.Base Methodsfmap :: (a -> b) -> IO a -> IO b #(<$) :: a -> IO b -> IO a # Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodsfmap :: (a -> b) -> Par1 a -> Par1 b #(<$) :: a -> Par1 b -> Par1 a # Instance detailsDefined in Language.Haskell.TH.Syntax Methodsfmap :: (a -> b) -> Q a -> Q b #(<$) :: a -> Q b -> Q a # Functor Rose Instance detailsDefined in Test.QuickCheck.Property Methodsfmap :: (a -> b) -> Rose a -> Rose b #(<$) :: a -> Rose b -> Rose 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) -> OrderedList a -> OrderedList b #(<$) :: a -> OrderedList b -> OrderedList 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) -> SortedList a -> SortedList b #(<$) :: a -> SortedList b -> SortedList 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) -> Negative a -> Negative b #(<$) :: a -> Negative b -> Negative 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) -> 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) -> Large a -> Large b #(<$) :: a -> Large b -> Large 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) -> Shrink2 a -> Shrink2 b #(<$) :: a -> Shrink2 b -> Shrink2 a # Instance detailsDefined in Test.QuickCheck.Modifiers Methodsfmap :: (a -> b) -> Smart a -> Smart b #(<$) :: a -> Smart b -> Smart a # Instance detailsDefined in Test.QuickCheck.Gen Methodsfmap :: (a -> b) -> Gen a -> Gen b #(<$) :: a -> Gen b -> Gen 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-2.1 Instance detailsDefined in Control.Applicative Methodsfmap :: (a -> b) -> ZipList a -> ZipList b #(<$) :: a -> ZipList b -> ZipList 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.6.0.0 Instance detailsDefined in Control.Exception Methodsfmap :: (a -> b) -> Handler a -> Handler b #(<$) :: a -> Handler b -> Handler 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) -> Sum a -> Sum b #(<$) :: a -> Sum b -> Sum 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-2.1 Instance detailsDefined in Text.ParserCombinators.ReadPrec Methodsfmap :: (a -> b) -> ReadPrec a -> ReadPrec b #(<$) :: a -> ReadPrec b -> ReadPrec 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-4.9.0.0 Instance detailsDefined in GHC.Base Methodsfmap :: (a -> b) -> NonEmpty a -> NonEmpty b #(<$) :: a -> NonEmpty b -> NonEmpty a # Instance detailsDefined in Data.IntMap.Internal Methodsfmap :: (a -> b) -> IntMap a -> IntMap b #(<$) :: a -> IntMap b -> IntMap a # Instance detailsDefined in Data.Tree Methodsfmap :: (a -> b) -> Tree a -> Tree b #(<$) :: a -> Tree b -> Tree 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) -> FingerTree a -> FingerTree b #(<$) :: a -> FingerTree b -> FingerTree 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) -> Node a -> Node b #(<$) :: a -> Node b -> Node 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) -> 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 Test.SmallCheck.Series Methodsfmap :: (a -> b) -> Positive a -> Positive b #(<$) :: a -> Positive b -> Positive a # 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: 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-3.0 Instance detailsDefined in Data.Either Methodsfmap :: (a0 -> b) -> Either a a0 -> Either a b #(<$) :: a0 -> Either a b -> Either a a0 # Functor (V1 :: Type -> Type) Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics Methodsfmap :: (a -> b) -> V1 a -> V1 b #(<$) :: a -> V1 b -> V1 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 # Functor ((,) a) Since: base-2.1 Instance detailsDefined in GHC.Base Methodsfmap :: (a0 -> b) -> (a, a0) -> (a, b) #(<$) :: a0 -> (a, b) -> (a, a0) # 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 # 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 # 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 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 Char :: Type -> Type) 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 # Functor (URec Float :: Type -> Type) 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 # Functor (URec Int :: Type -> Type) 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 # Functor (URec Word :: Type -> Type) 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 # Functor (URec (Ptr ()) :: Type -> 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 # 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) # 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 # (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 ((->) r :: Type -> Type) Since: base-2.1 Instance detailsDefined in GHC.Base Methodsfmap :: (a -> b) -> (r -> a) -> r -> b #(<$) :: a -> (r -> b) -> r -> a # Functor (K1 i c :: Type -> 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 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 ((,,,) 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 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 (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 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 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 (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 (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 # class Read a where # 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 readsPrec d r = readParen (d > app_prec) (\r -> [(Leaf m,t) | ("Leaf",s) <- lex r, (m,t) <- readsPrec (app_prec+1) s]) r ++ readParen (d > up_prec) (\r -> [(u:^:v,w) | (u,s) <- readsPrec (up_prec+1) r, (":^:",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 m <- step readPrec return (Leaf m)) +++ (prec up_prec$ do
u <- step readPrec
Symbol ":^:" <- lexP
v <- step readPrec
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.

readList :: ReadS [a] #

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
 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.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-4.8.0.0 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 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 Read () Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS () #readList :: ReadS [()] #readListPrec :: ReadPrec [()] # Since: base-2.1 Instance detailsDefined in Data.Version 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 Instance detailsDefined in Test.QuickCheck.Modifiers Methods Instance detailsDefined in Test.QuickCheck.Modifiers Methods Instance detailsDefined in Test.QuickCheck.Modifiers 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 GHC.IO.Exception 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-4.6.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 Since: base-4.9.0.0 Instance detailsDefined in GHC.Generics 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-2.1 Instance detailsDefined in GHC.Read Methods Since: base-2.1 Instance detailsDefined in GHC.Read Methods Instance detailsDefined in System.Clock Methods Instance detailsDefined in System.Clock Methods Instance detailsDefined in Data.IntSet.Internal Methods Source # Instance detailsDefined in Data.Convertible.Base Methods 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 (Maybe a) Since: base-2.1 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (Maybe a) #readList :: ReadS [Maybe a] # (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 p => Read (Par1 p) Since: base-4.7.0.0 Instance detailsDefined in GHC.Generics MethodsreadsPrec :: Int -> ReadS (Par1 p) #readList :: ReadS [Par1 p] # Read a => Read (Fixed a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodsreadsPrec :: Int -> ReadS (Fixed a) #readList :: ReadS [Fixed a] # Read a => Read (OrderedList a) Instance detailsDefined in Test.QuickCheck.Modifiers Methods Read a => Read (NonEmptyList a) Instance detailsDefined in Test.QuickCheck.Modifiers Methods Read a => Read (SortedList a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodsreadsPrec :: Int -> ReadS (SortedList a) # Read a => Read (Positive a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodsreadsPrec :: Int -> ReadS (Positive a) # Read a => Read (Negative a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodsreadsPrec :: Int -> ReadS (Negative a) # Read a => Read (NonZero a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodsreadsPrec :: Int -> ReadS (NonZero a) # 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 (Large a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodsreadsPrec :: Int -> ReadS (Large a) #readList :: ReadS [Large a] # Read a => Read (Small a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodsreadsPrec :: Int -> ReadS (Small a) #readList :: ReadS [Small a] # Read a => Read (Shrink2 a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodsreadsPrec :: Int -> ReadS (Shrink2 a) # Read a => Read (Complex a) Since: base-2.1 Instance detailsDefined in Data.Complex MethodsreadsPrec :: Int -> ReadS (Complex 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 (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 (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 a => Read (Product a) Since: base-2.1 Instance detailsDefined in Data.Semigroup.Internal MethodsreadsPrec :: Int -> ReadS (Product a) # Read a => Read (NonEmpty a) Since: base-4.11.0.0 Instance detailsDefined in GHC.Read MethodsreadsPrec :: Int -> ReadS (NonEmpty a) # Read e => Read (IntMap e) Instance detailsDefined in Data.IntMap.Internal MethodsreadsPrec :: Int -> ReadS (IntMap e) #readList :: ReadS [IntMap e] # Read a => Read (Tree a) Instance detailsDefined in Data.Tree MethodsreadsPrec :: Int -> ReadS (Tree a) #readList :: ReadS [Tree a] # 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 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] # 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) # 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 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)] # (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] # 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] # (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 (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 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)] # 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 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 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 (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 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 (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 (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 (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 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)] # (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 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
 Since: base-2.0.1 Instance detailsDefined in GHC.Real 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.0.1 Instance detailsDefined in GHC.Real Methods Since: base-4.8.0.0 Instance detailsDefined in GHC.Real Methods Since: base-2.1 Instance detailsDefined in GHC.Real 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 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 Integral a => Real (Ratio a) Since: base-2.0.1 Instance detailsDefined in GHC.Real MethodstoRational :: Ratio a -> Rational # 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 (Small a) Instance detailsDefined in Test.QuickCheck.Modifiers MethodstoRational :: Small a -> Rational # Real a => Real (Shrink2 a) Instance detailsDefined in Test.QuickCheck.Modifiers Methods Real a => Real (Identity a) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Identity Methods Real a => Real (Positive a) Instance detailsDefined in Test.SmallCheck.Series Methods 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 (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 # 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 #

Efficient, machine-independent access to the components of a floating-point number.

Minimal complete definition

Methods

floatRadix :: a -> Integer #

a constant function, returning the radix of the representation (often 2)

floatDigits :: a -> Int #

a constant function, returning the number of digits of floatRadix in the significand

floatRange :: a -> (Int, Int) #

a constant function, returning the lowest and highest values the exponent may assume

decodeFloat :: a -> (Integer, Int) #

The function decodeFloat applied to a real floating-point number returns the significand expressed as an Integer and an appropriately scaled exponent (an Int). If decodeFloat x yields (m,n), then x is equal in value to m*b^^n, where b is the floating-point radix, and furthermore, either m and n are both zero or else b^(d-1) <= abs m < b^d, where d is the value of floatDigits x. In particular, decodeFloat 0 = (0,0). If the type contains a negative zero, also decodeFloat (-0.0) = (0,0). The result of decodeFloat x is unspecified if either of isNaN x or isInfinite x is True.

encodeFloat :: Integer -> Int -> a #

encodeFloat performs the inverse of decodeFloat in the sense that for finite x with the exception of -0.0, uncurry encodeFloat (decodeFloat x) = x. encodeFloat m n is one of the two closest representable floating-point numbers to m*b^^n (or ±Infinity if overflow occurs); usually the closer, but if m contains too many bits, the result may be rounded in the wrong direction.

exponent :: a -> Int #

exponent corresponds to the second component of decodeFloat. exponent 0 = 0 and for finite nonzero x, exponent x = snd (decodeFloat x) + floatDigits x. If x is a finite floating-point number, it is equal in value to significand x * b ^^ exponent x, where b is the floating-point radix. The behaviour is unspecified on infinite or NaN values.

significand :: a -> a #

The first component of decodeFloat, scaled to lie in the open interval (-1,1), either 0.0 or of absolute value >= 1/b, where b is the floating-point radix. The behaviour is unspecified on infinite or NaN values.

scaleFloat :: Int -> a -> a #

multiplies a floating-point number by an integer power of the radix

isDenormalized :: a -> Bool #

True if the argument is too small to be represented in normalized format

isNegativeZero :: a -> Bool #

True if the argument is an IEEE negative zero

isIEEE :: a -> Bool #

True if the argument is an IEEE floating point number

atan2 :: a -> a -> a #

a version of arctangent taking two real floating-point arguments. For real floating x and y, atan2 y x computes the angle (from the positive x-axis) of the vector from the origin to the point (x,y). atan2 y x returns a value in the range [-pi, pi]. It follows the Common Lisp semantics for the origin when signed zeroes are supported. atan2 y 1, with y in a type that is RealFloat, should return the same value as atan y. A default definition of atan2 is provided, but implementors can provide a more accurate implementation.

#### Instances

Instances details
 Since: base-2.1 Instance detailsDefined in GHC.Float MethodsfloatRange :: Double -> (Int, Int) #decodeFloat :: Double -> (Integer, Int) #isNaN :: Double -> Bool #atan2 :: Double -> Double -> Double # Since: base-2.1 Instance detailsDefined in GHC.Float MethodsfloatRange :: Float -> (Int, Int) #decodeFloat :: Float -> (Integer, Int) #scaleFloat :: Int -> Float -> Float #isNaN :: Float -> Bool #isIEEE :: Float -> Bool #</