classy-prelude-1.5.0: A typeclass-based Prelude.

ClassyPrelude

Synopsis

# CorePrelude

seq :: a -> b -> b #

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.

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 = ...

($) :: (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.

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.

Minimal complete definition

Methods

minBound :: a #

maxBound :: a #

Instances
 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 :: () # Instance detailsDefined in GHC.Generics Methods Instance detailsDefined in GHC.Generics Methods Instance detailsDefined in GHC.Generics Methods 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.Ptr Methods Instance detailsDefined in Foreign.Ptr Methods Instance detailsDefined in GHC.Unicode Methods Bounded a => Bounded (Min a) Instance detailsDefined in Data.Semigroup MethodsminBound :: Min a #maxBound :: Min a # Bounded a => Bounded (Max a) Instance detailsDefined in Data.Semigroup MethodsminBound :: Max a #maxBound :: Max a # Bounded a => Bounded (First a) Instance detailsDefined in Data.Semigroup Methods Bounded a => Bounded (Last a) Instance detailsDefined in Data.Semigroup Methods Bounded m => Bounded (WrappedMonoid m) Instance detailsDefined in Data.Semigroup Methods Bounded a => Bounded (Identity a) Instance detailsDefined in Data.Functor.Identity 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) 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) Instance detailsDefined in Data.Functor.Const MethodsminBound :: Const a b #maxBound :: Const a b # a ~ b => Bounded (a :~: b) Since: base-4.7.0.0 Instance detailsDefined in Data.Type.Equality MethodsminBound :: a :~: b #maxBound :: a :~: b # Bounded b => Bounded (Tagged s b) Instance detailsDefined in Data.Tagged MethodsminBound :: Tagged s b #maxBound :: Tagged s 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
| 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..].

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

Used in Haskell's translation of [n,n'..].

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

Used in Haskell's translation of [n..m].

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

Used in Haskell's translation of [n,n'..m].

Instances

class Eq a where #

The Eq class defines equality (==) and inequality (/=). All the basic datatypes exported by the Prelude are instances of Eq, and Eq may be derived for any datatype whose constituents are also instances of Eq.

Minimal complete definition: either == or /=.

Minimal complete definition

Methods

(==) :: a -> a -> Bool infix 4 #

(/=) :: a -> a -> Bool infix 4 #

Instances

class Fractional a => Floating a where #

Trigonometric and hyperbolic functions and related functions.

Minimal complete definition

Methods

pi :: a #

exp :: a -> a #

log :: a -> a #

sqrt :: a -> a #

(**) :: a -> a -> a infixr 8 #

logBase :: a -> a -> a #

sin :: a -> a #

cos :: a -> a #

tan :: a -> a #

asin :: a -> a #

acos :: a -> a #

atan :: a -> a #

sinh :: a -> a #

cosh :: a -> a #

tanh :: a -> a #

asinh :: a -> a #

acosh :: a -> a #

atanh :: a -> a #

Instances
 Since: base-2.1 Instance detailsDefined in GHC.Float Methodsexp :: Double -> Double #log :: Double -> Double #(**) :: Double -> Double -> Double #sin :: Double -> Double #cos :: Double -> Double #tan :: Double -> Double # Since: base-2.1 Instance detailsDefined in GHC.Float Methodspi :: Float #exp :: Float -> Float #log :: Float -> Float #sqrt :: Float -> Float #(**) :: Float -> Float -> Float #logBase :: Float -> Float -> Float #sin :: Float -> Float #cos :: Float -> Float #tan :: Float -> Float #asin :: Float -> Float #acos :: Float -> Float #atan :: Float -> Float #sinh :: Float -> Float #cosh :: Float -> Float #tanh :: Float -> Float #asinh :: Float -> Float #acosh :: Float -> Float #atanh :: Float -> Float #log1p :: Float -> Float #expm1 :: Float -> Float # Instance detailsDefined in Foreign.C.Types Methodsexp :: CFloat -> CFloat #log :: CFloat -> CFloat #(**) :: CFloat -> CFloat -> CFloat #sin :: CFloat -> CFloat #cos :: CFloat -> CFloat #tan :: CFloat -> CFloat # Instance detailsDefined in Foreign.C.Types Methods RealFloat a => Floating (Complex a) Since: base-2.1 Instance detailsDefined in Data.Complex Methodspi :: Complex a #exp :: Complex a -> Complex a #log :: Complex a -> Complex a #sqrt :: Complex a -> Complex a #(**) :: Complex a -> Complex a -> Complex a #logBase :: Complex a -> Complex a -> Complex a #sin :: Complex a -> Complex a #cos :: Complex a -> Complex a #tan :: Complex a -> Complex a #asin :: Complex a -> Complex a #acos :: Complex a -> Complex a #atan :: Complex a -> Complex a #sinh :: Complex a -> Complex a #cosh :: Complex a -> Complex a #tanh :: Complex a -> Complex a #asinh :: Complex a -> Complex a #acosh :: Complex a -> Complex a #atanh :: Complex a -> Complex a #log1p :: Complex a -> Complex a #expm1 :: Complex a -> Complex a #log1pexp :: Complex a -> Complex a #log1mexp :: Complex a -> Complex a # Floating a => Floating (Identity a) Instance detailsDefined in Data.Functor.Identity Methodspi :: Identity a #exp :: Identity a -> Identity a #log :: Identity a -> Identity a #sqrt :: Identity a -> Identity a #(**) :: Identity a -> Identity a -> Identity a #logBase :: Identity a -> Identity a -> Identity a #sin :: Identity a -> Identity a #cos :: Identity a -> Identity a #tan :: Identity a -> Identity a #asin :: Identity a -> Identity a #acos :: Identity a -> Identity a #atan :: Identity a -> Identity a #sinh :: Identity a -> Identity a #cosh :: Identity a -> Identity a #tanh :: Identity a -> Identity a #asinh :: Identity a -> Identity a #acosh :: Identity a -> Identity a #atanh :: Identity a -> Identity a #log1p :: Identity a -> Identity a #expm1 :: Identity a -> Identity a #log1pexp :: Identity a -> Identity a #log1mexp :: Identity a -> Identity a # Floating a => Floating (Const a b) Instance detailsDefined in Data.Functor.Const Methodspi :: Const a b #exp :: Const a b -> Const a b #log :: Const a b -> Const a b #sqrt :: Const a b -> Const a b #(**) :: Const a b -> Const a b -> Const a b #logBase :: Const a b -> Const a b -> Const a b #sin :: Const a b -> Const a b #cos :: Const a b -> Const a b #tan :: Const a b -> Const a b #asin :: Const a b -> Const a b #acos :: Const a b -> Const a b #atan :: Const a b -> Const a b #sinh :: Const a b -> Const a b #cosh :: Const a b -> Const a b #tanh :: Const a b -> Const a b #asinh :: Const a b -> Const a b #acosh :: Const a b -> Const a b #atanh :: Const a b -> Const a b #log1p :: Const a b -> Const a b #expm1 :: Const a b -> Const a b #log1pexp :: Const a b -> Const a b #log1mexp :: Const a b -> Const a b # Floating a => Floating (Tagged s a) Instance detailsDefined in Data.Tagged Methodspi :: Tagged s a #exp :: Tagged s a -> Tagged s a #log :: Tagged s a -> Tagged s a #sqrt :: Tagged s a -> Tagged s a #(**) :: Tagged s a -> Tagged s a -> Tagged s a #logBase :: Tagged s a -> Tagged s a -> Tagged s a #sin :: Tagged s a -> Tagged s a #cos :: Tagged s a -> Tagged s a #tan :: Tagged s a -> Tagged s a #asin :: Tagged s a -> Tagged s a #acos :: Tagged s a -> Tagged s a #atan :: Tagged s a -> Tagged s a #sinh :: Tagged s a -> Tagged s a #cosh :: Tagged s a -> Tagged s a #tanh :: Tagged s a -> Tagged s a #asinh :: Tagged s a -> Tagged s a #acosh :: Tagged s a -> Tagged s a #atanh :: Tagged s a -> Tagged s a #log1p :: Tagged s a -> Tagged s a #expm1 :: Tagged s a -> Tagged s a #log1pexp :: Tagged s a -> Tagged s a #log1mexp :: Tagged s a -> Tagged s a #

class Num a => Fractional a where #

Fractional numbers, supporting real division.

Minimal complete definition

fromRational, (recip | (/))

Methods

(/) :: a -> a -> a infixl 7 #

fractional division

recip :: a -> a #

reciprocal fraction

fromRational :: Rational -> a #

Conversion from a Rational (that is Ratio Integer). A floating literal stands for an application of fromRational to a value of type Rational, so such literals have type (Fractional a) => a.

Instances
 Instance detailsDefined in Foreign.C.Types Methods(/) :: CFloat -> CFloat -> CFloat # Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Data.Time.Clock.Internal.DiffTime Methods Integral a => Fractional (Ratio a) Since: base-2.0.1 Instance detailsDefined in GHC.Real Methods(/) :: Ratio a -> Ratio a -> Ratio a #recip :: Ratio a -> Ratio a # RealFloat a => Fractional (Complex a) Since: base-2.1 Instance detailsDefined in Data.Complex Methods(/) :: Complex a -> Complex a -> Complex a #recip :: Complex a -> Complex a # HasResolution a => Fractional (Fixed a) Since: base-2.1 Instance detailsDefined in Data.Fixed Methods(/) :: Fixed a -> Fixed a -> Fixed a #recip :: Fixed a -> Fixed a # Fractional a => Fractional (Identity a) Instance detailsDefined in Data.Functor.Identity Methods(/) :: Identity a -> Identity a -> Identity a #recip :: Identity a -> Identity a # Fractional a => Fractional (Const a b) Instance detailsDefined in Data.Functor.Const Methods(/) :: Const a b -> Const a b -> Const a b #recip :: Const a b -> Const a b #fromRational :: Rational -> Const a b # Fractional a => Fractional (Tagged s a) Instance detailsDefined in Data.Tagged Methods(/) :: Tagged s a -> Tagged s a -> Tagged s a #recip :: Tagged s a -> Tagged s a #fromRational :: Rational -> Tagged s a #

class (Real a, Enum a) => Integral a where #

Integral numbers, supporting integer division.

Minimal complete definition

Methods

quot :: a -> a -> a infixl 7 #

integer division truncated toward zero

rem :: a -> a -> a infixl 7 #

integer remainder, satisfying

(x quot y)*y + (x rem y) == x

div :: a -> a -> a infixl 7 #

integer division truncated toward negative infinity

mod :: a -> a -> a infixl 7 #

integer modulus, satisfying

(x div y)*y + (x mod y) == x

quotRem :: a -> a -> (a, a) #

simultaneous quot and rem

divMod :: a -> a -> (a, a) #

simultaneous div and mod

toInteger :: a -> Integer #

conversion to Integer

Instances
 Since: base-2.0.1 Instance detailsDefined in GHC.Real Methodsquot :: Int -> Int -> Int #rem :: Int -> Int -> Int #div :: Int -> Int -> Int #mod :: Int -> Int -> Int #quotRem :: Int -> Int -> (Int, Int) #divMod :: Int -> Int -> (Int, Int) # Since: base-2.1 Instance detailsDefined in GHC.Int Methodsquot :: Int8 -> Int8 -> Int8 #rem :: Int8 -> Int8 -> Int8 #div :: Int8 -> Int8 -> Int8 #mod :: Int8 -> Int8 -> Int8 #quotRem :: Int8 -> Int8 -> (Int8, Int8) #divMod :: Int8 -> Int8 -> (Int8, Int8) # Since: base-2.1 Instance detailsDefined in GHC.Int Methodsquot :: Int16 -> Int16 -> Int16 #rem :: Int16 -> Int16 -> Int16 #div :: Int16 -> Int16 -> Int16 #mod :: Int16 -> Int16 -> Int16 #quotRem :: Int16 -> Int16 -> (Int16, Int16) #divMod :: Int16 -> Int16 -> (Int16, Int16) # Since: base-2.1 Instance detailsDefined in GHC.Int Methodsquot :: Int32 -> Int32 -> Int32 #rem :: Int32 -> Int32 -> Int32 #div :: Int32 -> Int32 -> Int32 #mod :: Int32 -> Int32 -> Int32 #quotRem :: Int32 -> Int32 -> (Int32, Int32) #divMod :: Int32 -> Int32 -> (Int32, Int32) # Since: base-2.1 Instance detailsDefined in GHC.Int Methodsquot :: Int64 -> Int64 -> Int64 #rem :: Int64 -> Int64 -> Int64 #div :: Int64 -> Int64 -> Int64 #mod :: Int64 -> Int64 -> Int64 #quotRem :: Int64 -> Int64 -> (Int64, Int64) #divMod :: Int64 -> Int64 -> (Int64, Int64) # Since: base-2.0.1 Instance detailsDefined in GHC.Real MethodsquotRem :: Integer -> Integer -> (Integer, Integer) #divMod :: Integer -> Integer -> (Integer, Integer) # Since: base-4.8.0.0 Instance detailsDefined in GHC.Natural MethodsquotRem :: Natural -> Natural -> (Natural, Natural) #divMod :: Natural -> Natural -> (Natural, Natural) # Since: base-2.1 Instance detailsDefined in GHC.Real Methodsquot :: Word -> Word -> Word #rem :: Word -> Word -> Word #div :: Word -> Word -> Word #mod :: Word -> Word -> Word #quotRem :: Word -> Word -> (Word, Word) #divMod :: Word -> Word -> (Word, Word) # Since: base-2.1 Instance detailsDefined in GHC.Word Methodsquot :: Word8 -> Word8 -> Word8 #rem :: Word8 -> Word8 -> Word8 #div :: Word8 -> Word8 -> Word8 #mod :: Word8 -> Word8 -> Word8 #quotRem :: Word8 -> Word8 -> (Word8, Word8) #divMod :: Word8 -> Word8 -> (Word8, Word8) # Since: base-2.1 Instance detailsDefined in GHC.Word Methodsquot :: Word16 -> Word16 -> Word16 #rem :: Word16 -> Word16 -> Word16 #div :: Word16 -> Word16 -> Word16 #mod :: Word16 -> Word16 -> Word16 #quotRem :: Word16 -> Word16 -> (Word16, Word16) #divMod :: Word16 -> Word16 -> (Word16, Word16) # Since: base-2.1 Instance detailsDefined in GHC.Word Methodsquot :: Word32 -> Word32 -> Word32 #rem :: Word32 -> Word32 -> Word32 #div :: Word32 -> Word32 -> Word32 #mod :: Word32 -> Word32 -> Word32 #quotRem :: Word32 -> Word32 -> (Word32, Word32) #divMod :: Word32 -> Word32 -> (Word32, Word32) # Since: base-2.1 Instance detailsDefined in GHC.Word Methodsquot :: Word64 -> Word64 -> Word64 #rem :: Word64 -> Word64 -> Word64 #div :: Word64 -> Word64 -> Word64 #mod :: Word64 -> Word64 -> Word64 #quotRem :: Word64 -> Word64 -> (Word64, Word64) #divMod :: Word64 -> Word64 -> (Word64, Word64) # Instance detailsDefined in Foreign.C.Types Methodsquot :: CChar -> CChar -> CChar #rem :: CChar -> CChar -> CChar #div :: CChar -> CChar -> CChar #mod :: CChar -> CChar -> CChar #quotRem :: CChar -> CChar -> (CChar, CChar) #divMod :: CChar -> CChar -> (CChar, CChar) # Instance detailsDefined in Foreign.C.Types Methodsquot :: CSChar -> CSChar -> CSChar #rem :: CSChar -> CSChar -> CSChar #div :: CSChar -> CSChar -> CSChar #mod :: CSChar -> CSChar -> CSChar #quotRem :: CSChar -> CSChar -> (CSChar, CSChar) #divMod :: CSChar -> CSChar -> (CSChar, CSChar) # Instance detailsDefined in Foreign.C.Types Methodsquot :: CUChar -> CUChar -> CUChar #rem :: CUChar -> CUChar -> CUChar #div :: CUChar -> CUChar -> CUChar #mod :: CUChar -> CUChar -> CUChar #quotRem :: CUChar -> CUChar -> (CUChar, CUChar) #divMod :: CUChar -> CUChar -> (CUChar, CUChar) # Instance detailsDefined in Foreign.C.Types Methodsquot :: CShort -> CShort -> CShort #rem :: CShort -> CShort -> CShort #div :: CShort -> CShort -> CShort #mod :: CShort -> CShort -> CShort #quotRem :: CShort -> CShort -> (CShort, CShort) #divMod :: CShort -> CShort -> (CShort, CShort) # Instance detailsDefined in Foreign.C.Types MethodsquotRem :: CUShort -> CUShort -> (CUShort, CUShort) #divMod :: CUShort -> CUShort -> (CUShort, CUShort) # Instance detailsDefined in Foreign.C.Types Methodsquot :: CInt -> CInt -> CInt #rem :: CInt -> CInt -> CInt #div :: CInt -> CInt -> CInt #mod :: CInt -> CInt -> CInt #quotRem :: CInt -> CInt -> (CInt, CInt) #divMod :: CInt -> CInt -> (CInt, CInt) # Instance detailsDefined in Foreign.C.Types Methodsquot :: CUInt -> CUInt -> CUInt #rem :: CUInt -> CUInt -> CUInt #div :: CUInt -> CUInt -> CUInt #mod :: CUInt -> CUInt -> CUInt #quotRem :: CUInt -> CUInt -> (CUInt, CUInt) #divMod :: CUInt -> CUInt -> (CUInt, CUInt) # Instance detailsDefined in Foreign.C.Types Methodsquot :: CLong -> CLong -> CLong #rem :: CLong -> CLong -> CLong #div :: CLong -> CLong -> CLong #mod :: CLong -> CLong -> CLong #quotRem :: CLong -> CLong -> (CLong, CLong) #divMod :: CLong -> CLong -> (CLong, CLong) # Instance detailsDefined in Foreign.C.Types Methodsquot :: CULong -> CULong -> CULong #rem :: CULong -> CULong -> CULong #div :: CULong -> CULong -> CULong #mod :: CULong -> CULong -> CULong #quotRem :: CULong -> CULong -> (CULong, CULong) #divMod :: CULong -> CULong -> (CULong, CULong) # Instance detailsDefined in Foreign.C.Types Methodsquot :: CLLong -> CLLong -> CLLong #rem :: CLLong -> CLLong -> CLLong #div :: CLLong -> CLLong -> CLLong #mod :: CLLong -> CLLong -> CLLong #quotRem :: CLLong -> CLLong -> (CLLong, CLLong) #divMod :: CLLong -> CLLong -> (CLLong, CLLong) # Instance detailsDefined in Foreign.C.Types MethodsquotRem :: CULLong -> CULLong -> (CULLong, CULLong) #divMod :: CULLong -> CULLong -> (CULLong, CULLong) # Instance detailsDefined in Foreign.C.Types Methodsquot :: CBool -> CBool -> CBool #rem :: CBool -> CBool -> CBool #div :: CBool -> CBool -> CBool #mod :: CBool -> CBool -> CBool #quotRem :: CBool -> CBool -> (CBool, CBool) #divMod :: CBool -> CBool -> (CBool, CBool) # Instance detailsDefined in Foreign.C.Types MethodsquotRem :: CPtrdiff -> CPtrdiff -> (CPtrdiff, CPtrdiff) #divMod :: CPtrdiff -> CPtrdiff -> (CPtrdiff, CPtrdiff) # Instance detailsDefined in Foreign.C.Types Methodsquot :: CSize -> CSize -> CSize #rem :: CSize -> CSize -> CSize #div :: CSize -> CSize -> CSize #mod :: CSize -> CSize -> CSize #quotRem :: CSize -> CSize -> (CSize, CSize) #divMod :: CSize -> CSize -> (CSize, CSize) # Instance detailsDefined in Foreign.C.Types Methodsquot :: CWchar -> CWchar -> CWchar #rem :: CWchar -> CWchar -> CWchar #div :: CWchar -> CWchar -> CWchar #mod :: CWchar -> CWchar -> CWchar #quotRem :: CWchar -> CWchar -> (CWchar, CWchar) #divMod :: CWchar -> CWchar -> (CWchar, CWchar) # Instance detailsDefined in Foreign.C.Types Methods Instance detailsDefined in Foreign.C.Types MethodsquotRem :: CIntPtr -> CIntPtr -> (CIntPtr, CIntPtr) #divMod :: CIntPtr -> CIntPtr -> (CIntPtr, CIntPtr) # Instance detailsDefined in Foreign.C.Types MethodsquotRem :: CUIntPtr -> CUIntPtr -> (CUIntPtr, CUIntPtr) #divMod :: CUIntPtr -> CUIntPtr -> (CUIntPtr, CUIntPtr) # Instance detailsDefined in Foreign.C.Types MethodsquotRem :: CIntMax -> CIntMax -> (CIntMax, CIntMax) #divMod :: CIntMax -> CIntMax -> (CIntMax, CIntMax) # Instance detailsDefined in Foreign.C.Types MethodsquotRem :: CUIntMax -> CUIntMax -> (CUIntMax, CUIntMax) #divMod :: CUIntMax -> CUIntMax -> (CUIntMax, CUIntMax) # Instance detailsDefined in Foreign.Ptr MethodsquotRem :: WordPtr -> WordPtr -> (WordPtr, WordPtr) #divMod :: WordPtr -> WordPtr -> (WordPtr, WordPtr) # Instance detailsDefined in Foreign.Ptr Methodsquot :: IntPtr -> IntPtr -> IntPtr #rem :: IntPtr -> IntPtr -> IntPtr #div :: IntPtr -> IntPtr -> IntPtr #mod :: IntPtr -> IntPtr -> IntPtr #quotRem :: IntPtr -> IntPtr -> (IntPtr, IntPtr) #divMod :: IntPtr -> IntPtr -> (IntPtr, IntPtr) # Integral a => Integral (Identity a) Instance detailsDefined in Data.Functor.Identity Methodsquot :: Identity a -> Identity a -> Identity a #rem :: Identity a -> Identity a -> Identity a #div :: Identity a -> Identity a -> Identity a #mod :: Identity a -> Identity a -> Identity a #quotRem :: Identity a -> Identity a -> (Identity a, Identity a) #divMod :: Identity a -> Identity a -> (Identity a, Identity a) # Integral a => Integral (Const a b) Instance detailsDefined in Data.Functor.Const Methodsquot :: Const a b -> Const a b -> Const a b #rem :: Const a b -> Const a b -> Const a b #div :: Const a b -> Const a b -> Const a b #mod :: Const a b -> Const a b -> Const a b #quotRem :: Const a b -> Const a b -> (Const a b, Const a b) #divMod :: Const a b -> Const a b -> (Const a b, Const a b) #toInteger :: Const a b -> Integer # Integral a => Integral (Tagged s a) Instance detailsDefined in Data.Tagged Methodsquot :: Tagged s a -> Tagged s a -> Tagged s a #rem :: Tagged s a -> Tagged s a -> Tagged s a #div :: Tagged s a -> Tagged s a -> Tagged s a #mod :: Tagged s a -> Tagged s a -> Tagged s a #quotRem :: Tagged s a -> Tagged s a -> (Tagged s a, Tagged s a) #divMod :: Tagged s a -> Tagged s a -> (Tagged s a, Tagged s a) #toInteger :: Tagged s a -> Integer #

class Applicative m => Monad (m :: * -> *) 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 laws:

• return a >>= k  =  k a
• m >>= return  =  m
• m >>= (\x -> k x >>= h)  =  (m >>= k) >>= h

Furthermore, the Monad and Applicative operations should relate as follows:

• pure = return
• (<*>) = ap

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.

(>>) :: 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.

return :: a -> m a #

Inject a value into the monadic type.

fail :: String -> m a #

Fail with a message. This operation is not part of the mathematical definition of a monad, but is invoked on pattern-match failure in a do expression.

As part of the MonadFail proposal (MFP), this function is moved to its own class MonadFail (see Control.Monad.Fail for more details). The definition here will be removed in a future release.

Instances