| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Prelude
Description
Synopsis
- (!!) :: [a] -> Int -> a
- (++) :: [a] -> [a] -> [a]
- all :: (a -> Bool) -> [a] -> Bool
- and :: [Bool] -> Bool
- any :: (a -> Bool) -> [a] -> Bool
- break :: (a -> Bool) -> [a] -> ([a], [a])
- concat :: [[a]] -> [a]
- concatMap :: (a -> [b]) -> [a] -> [b]
- cycle :: [a] -> [a]
- drop :: Int -> [a] -> [a]
- dropWhile :: (a -> Bool) -> [a] -> [a]
- elem :: Eq a => a -> [a] -> Bool
- filter :: (a -> Bool) -> [a] -> [a]
- foldl :: (a -> b -> a) -> a -> [b] -> a
- foldl1 :: (a -> a -> a) -> [a] -> a
- foldr :: (a -> b -> b) -> b -> [a] -> b
- foldr1 :: (a -> a -> a) -> [a] -> a
- head :: [a] -> a
- init :: [a] -> [a]
- iterate :: (a -> a) -> a -> [a]
- last :: [a] -> a
- length :: [a] -> Int
- lines :: String -> [String]
- lookup :: Eq a => a -> [(a, b)] -> Maybe b
- map :: (a -> b) -> [a] -> [b]
- maximum :: Ord a => [a] -> a
- minimum :: Ord a => [a] -> a
- notElem :: Eq a => a -> [a] -> Bool
- null :: [a] -> Bool
- or :: [Bool] -> Bool
- product :: Num a => [a] -> a
- repeat :: a -> [a]
- replicate :: Int -> a -> [a]
- reverse :: [a] -> [a]
- scanl :: (a -> b -> a) -> a -> [b] -> [a]
- scanl1 :: (a -> a -> a) -> [a] -> [a]
- scanr :: (a -> b -> b) -> b -> [a] -> [b]
- scanr1 :: (a -> a -> a) -> [a] -> [a]
- span :: (a -> Bool) -> [a] -> ([a], [a])
- splitAt :: Int -> [a] -> ([a], [a])
- sum :: Num a => [a] -> a
- tail :: [a] -> [a]
- take :: Int -> [a] -> [a]
- takeWhile :: (a -> Bool) -> [a] -> [a]
- unlines :: [String] -> String
- unwords :: [String] -> String
- unzip :: [(a, b)] -> ([a], [b])
- unzip3 :: [(a, b, c)] -> ([a], [b], [c])
- words :: String -> [String]
- zip :: [a] -> [b] -> [(a, b)]
- zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]
- zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
- zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
- lex :: ReadS String
- read :: Read a => String -> a
- readParen :: Bool -> ReadS a -> ReadS a
- reads :: Read a => ReadS a
- showChar :: Char -> ShowS
- showParen :: Bool -> ShowS -> ShowS
- showString :: String -> ShowS
- shows :: Show a => a -> ShowS
- class Read a where
- type ReadS a = String -> [(a, String)]
- class Show a where
- type ShowS = String -> String
- appendFile :: FilePath -> String -> IO ()
- getChar :: IO Char
- getContents :: IO String
- getLine :: IO String
- interact :: (String -> String) -> IO ()
- print :: Show a => a -> IO ()
- putChar :: Char -> IO ()
- putStr :: String -> IO ()
- putStrLn :: String -> IO ()
- readFile :: FilePath -> IO String
- readIO :: Read a => String -> IO a
- readLn :: Read a => IO a
- writeFile :: FilePath -> String -> IO ()
- catch :: IO a -> (IOError -> IO a) -> IO a
- ioError :: IOError -> IO a
- userError :: String -> IOError
- type FilePath = String
- data IOError
- data Bool
- data Maybe a
- data Either a b
- data Ordering
- data Char
- type String = [Char]
- data Int
- data Integer
- data Float
- data Double
- type Rational = Ratio Integer
- data IO a
- class Eq a where
- class Eq a => Ord a where
- class Enum a where
- succ :: a -> a
- pred :: a -> a
- toEnum :: Int -> a
- fromEnum :: a -> Int
- enumFrom :: a -> [a]
- enumFromThen :: a -> a -> [a]
- enumFromTo :: a -> a -> [a]
- enumFromThenTo :: a -> a -> a -> [a]
- class Bounded a where
- class (Eq a, Show a) => Num a where
- class (Num a, Ord a) => Real a where
- toRational :: a -> Rational
- class (Real a, Enum a) => Integral a where
- class Num a => Fractional a where
- (/) :: a -> a -> a
- recip :: a -> a
- fromRational :: Rational -> a
- class Fractional a => Floating a where
- class (Real a, Fractional a) => RealFrac a where
- class (RealFrac a, Floating a) => RealFloat a where
- floatRadix :: a -> Integer
- floatDigits :: a -> Int
- floatRange :: a -> (Int, Int)
- decodeFloat :: a -> (Integer, Int)
- encodeFloat :: Integer -> Int -> a
- exponent :: a -> Int
- significand :: a -> a
- scaleFloat :: Int -> a -> a
- isNaN :: a -> Bool
- isInfinite :: a -> Bool
- isDenormalized :: a -> Bool
- isNegativeZero :: a -> Bool
- isIEEE :: a -> Bool
- atan2 :: a -> a -> a
- class Monad (m :: Type -> Type) where
- class Functor (f :: Type -> Type) where
- fmap :: (a -> b) -> f a -> f b
- mapM :: Monad m => (a -> m b) -> [a] -> m [b]
- mapM_ :: Monad m => (a -> m b) -> [a] -> m ()
- sequence :: Monad m => [m a] -> m [a]
- sequence_ :: Monad m => [m a] -> m ()
- (=<<) :: Monad m => (a -> m b) -> m a -> m b
- maybe :: b -> (a -> b) -> Maybe a -> b
- either :: (a -> c) -> (b -> c) -> Either a b -> c
- (&&) :: Bool -> Bool -> Bool
- (||) :: Bool -> Bool -> Bool
- not :: Bool -> Bool
- otherwise :: Bool
- subtract :: Num a => a -> a -> a
- even :: Integral a => a -> Bool
- odd :: Integral a => a -> Bool
- gcd :: Integral a => a -> a -> a
- lcm :: Integral a => a -> a -> a
- (^) :: (Num a, Integral b) => a -> b -> a
- (^^) :: (Fractional a, Integral b) => a -> b -> a
- fromIntegral :: (Integral a, Num b) => a -> b
- realToFrac :: (Real a, Fractional b) => a -> b
- fst :: (a, b) -> a
- snd :: (a, b) -> b
- curry :: ((a, b) -> c) -> a -> b -> c
- uncurry :: (a -> b -> c) -> (a, b) -> c
- id :: a -> a
- const :: a -> b -> a
- (.) :: (b -> c) -> (a -> b) -> a -> c
- flip :: (a -> b -> c) -> b -> a -> c
- ($) :: (a -> b) -> a -> b
- until :: (a -> Bool) -> (a -> a) -> a -> a
- asTypeOf :: a -> a -> a
- error :: String -> a
- undefined :: a
- seq :: a -> b -> b
- ($!) :: (a -> b) -> a -> b
Documentation
List index (subscript) operator, starting from 0. It is an instance of the more general
genericIndex, which takes an index of any integral type.
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.
break :: (a -> Bool) -> [a] -> ([a], [a]) #
break, applied to a predicate p and a list xs, returns a tuple where first element is longest prefix
(possibly empty) of xs of elements that do not satisfy p and second element is the remainder of the list:
break (> 3) [1,2,3,4,1,2,3,4] == ([1,2,3],[4,1,2,3,4]) break (< 9) [1,2,3] == ([],[1,2,3]) break (> 9) [1,2,3] == ([1,2,3],[])
break p is equivalent to span (not . p).
cycle ties a finite list into a circular one, or equivalently, the infinite repetition of the original list. It is
the identity on infinite lists.
drop n xs returns the suffix of xs after the first n elements, or [] if n > length xs:
drop 6 "Hello World!" == "World!" drop 3 [1,2,3,4,5] == [4,5] drop 3 [1,2] == [] drop 3 [] == [] drop (-1) [1,2] == [1,2] drop 0 [1,2] == [1,2]
It is an instance of the more general genericDrop, in which n may be of any integral
type.
dropWhile :: (a -> Bool) -> [a] -> [a] #
dropWhile p xs returns the suffix remaining after takeWhile p xs:
dropWhile (< 3) [1,2,3,4,5,1,2,3] == [3,4,5,1,2,3] dropWhile (< 9) [1,2,3] == [] dropWhile (< 0) [1,2,3] == [1,2,3]
filter :: (a -> Bool) -> [a] -> [a] #
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]
foldl :: (a -> b -> a) -> a -> [b] -> a #
foldl, applied to a binary operator, a starting value (typically the left-identity of the operator), and a
list, reduces the list using the binary operator, from left to right:
foldl f z [x1, x2, ..., xn] == (...((z ‘f‘ x1) ‘f‘ x2) ‘f‘...) ‘f‘ xn
The list must be finite.
foldr :: (a -> b -> b) -> b -> [a] -> b #
foldr, applied to a binary operator, a starting value (typically the right-identity of the operator), and a
list, reduces the list using the binary operator, from right to left:
foldr f z [x1, x2, ..., xn] == x1 ‘f‘ (x2 ‘f‘ ... (xn ‘f‘ z)...)
Return all the elements of a list except the last one. The list must be non-empty.
iterate :: (a -> a) -> a -> [a] #
iterate f x returns an infinite list of repeated applications of f to x:
iterate f x == [x, f x, f (f x), ...]
O(n). length returns the length of a finite list as an Int. It is an instance of the more general
genericLength, the result type of which may be any kind of number.
lines breaks a string up into a list of strings at newline characters. The resulting strings do not contain
newlines.
lookup :: Eq a => a -> [(a, b)] -> Maybe b #
lookup key assocs looks up a key in an association list.
map :: (a -> b) -> [a] -> [b] #
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, ...]
replicate :: Int -> a -> [a] #
replicate n x is a list of length n with x the value of every element. It is an instance of the more
general Data.List.genericReplicate, in which n may be of any integral type.
span :: (a -> Bool) -> [a] -> ([a], [a]) #
span, applied to a predicate p and a list xs, returns a tuple where first element is longest prefix (possibly
empty) of xs of elements that satisfy p and second element is the remainder of the list:
span (< 3) [1,2,3,4,1,2,3,4] == ([1,2],[3,4,1,2,3,4]) span (< 9) [1,2,3] == ([1,2,3],[]) span (< 0) [1,2,3] == ([],[1,2,3])
span p xs is equivalent to (takeWhile p xs, dropWhile p xs)
splitAt :: Int -> [a] -> ([a], [a]) #
splitAt n xs returns a tuple where first element is xs prefix of length n and second element is the
remainder of the list:
splitAt 6 "Hello World!" == ("Hello ","World!")
splitAt 3 [1,2,3,4,5] == ([1,2,3],[4,5])
splitAt 1 [1,2,3] == ([1],[2,3])
splitAt 3 [1,2,3] == ([1,2,3],[])
splitAt 4 [1,2,3] == ([1,2,3],[])
splitAt 0 [1,2,3] == ([],[1,2,3])
splitAt (-1) [1,2,3] == ([],[1,2,3])
It is equivalent to (take n xs, drop n xs). splitAt is an instance of the more general
genericSplitAt, in which n may be of any integral type.
take n, applied to a list xs, returns the prefix of xs of length n, or xs itself if n > length xs:
take 5 "Hello World!" == Hello take 3 [1,2,3,4,5] == [1,2,3] take 3 [1,2] == [1,2] take 3 [] == [] take (-1) [1,2] == [] take 0 [1,2] == []
It is an instance of the more general genericTake, in which n may be of any integral
type.
takeWhile :: (a -> Bool) -> [a] -> [a] #
takeWhile, applied to a predicate p and a list xs, returns the longest prefix (possibly empty) of xs of
elements that satisfy p:
takeWhile (< 3) [1,2,3,4,1,2,3,4] == [1,2] takeWhile (< 9) [1,2,3] == [1,2,3] takeWhile (< 0) [1,2,3] == []
unzip :: [(a, b)] -> ([a], [b]) #
unzip transforms a list of pairs into a list of first components and a list of second components.
words breaks a string up into a list of words, which were delimited by white space.
zip :: [a] -> [b] -> [(a, b)] #
zip takes two lists and returns a list of corresponding pairs. If one input list is short, excess elements
of the longer list are discarded.
showString :: String -> ShowS #
Instances
| Read GeneralCategory # | |
Defined in Data.Char | |
| Read Int # | |
| Read Int16 # | |
| Read Int32 # | |
| Read Int64 # | |
| Read Int8 # | |
| Read Word # | |
| Read Word16 # | |
| Read Word32 # | |
| Read Word64 # | |
| Read Word8 # | |
| Read CChar # | |
| Read CClock # | |
| Read CDouble # | |
| Read CFloat # | |
| Read CInt # | |
| Read CIntMax # | |
| Read CIntPtr # | |
| Read CLLong # | |
| Read CLong # | |
| Read CPtrdiff # | |
| Read CSChar # | |
| Read CShort # | |
| Read CSigAtomic # | |
Defined in Foreign.C.Types | |
| Read CSize # | |
| Read CTime # | |
| Read CUChar # | |
| Read CUInt # | |
| Read CUIntMax # | |
| Read CUIntPtr # | |
| Read CULLong # | |
| Read CULong # | |
| Read CUShort # | |
| Read CWchar # | |
| Read IntPtr # | |
| Read WordPtr # | |
| Read Char # | |
| Read Double # | |
| Read Float # | |
| Read Integer # | |
| Read ExitCode # | |
| Read BufferMode # | |
Defined in System.IO | |
| Read IOMode # | |
| Read SeekMode # | |
| Read () # | |
| Read a => Read (Complex a) # | |
| Read a => Read (Maybe a) # | |
| (Integral a, Read a) => Read (Ratio a) # | |
| Read a => Read [a] # | |
| (Ix a, Read a, Read b) => Read (Array a b) # | |
| (Read a, Read b) => Read (a, b) # | |
Instances
appendFile :: FilePath -> String -> IO () #
The computation appendFile file str function appends the string str, to the file file.
Note that writeFile and appendFile write a literal string to a file. To write a value of any printable
type, as with print, use the show function to convert the value to a string first.
main = appendFile "squares" (show [(x,x*x) | x <- [0,0.1..2]])
getContents :: IO String #
The getContents operation returns all user input as a single string, which is read lazily as it is needed
(same as hGetContents stdin).
interact :: (String -> String) -> IO () #
The interact function takes a function of type String->String as its argument. The entire input
from the standard input device is passed to this function as its argument, and the resulting string is
output on the standard output device.
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]])
Write a character to the standard output device (same as hPutChar stdout).
readFile :: FilePath -> IO String #
The readFile function reads a file and returns the contents of the file as a string. The file is read
lazily, on demand, as with getContents.
writeFile :: FilePath -> String -> IO () #
The computation writeFile file str function writes the string str, to the file file.
catch :: IO a -> (IOError -> IO a) -> IO a #
The catch function establishes a handler that receives any IOError raised in the action protected by
catch. An IOError is caught by the most recent handler established by catch. These handlers are
not selective: all IOErrors are caught. Exception propagation must be explicitly provided in a handler
by re-raising any unwanted exceptions. For example, in
f = catch g (\e -> if IO.isEOFError e then return [] else ioError e)
the function f returns [] when an end-of-file exception (cf. isEOFError) occurs in g; otherwise, the
exception is propagated to the next outer handler.
When an exception propagates outside the main program, the Haskell system prints the associated
IOError value and exits the program.
userError :: String -> IOError #
Construct an IOError value with a string describing the error. The fail method of the IO instance of
the Monad class raises a userError, thus:
instance Monad IO where ... fail s = ioError (userError s)
File and directory names are values of type String, whose precise meaning is operating system dependent.
Files can be opened, yielding a handle which can then be used to operate on the contents of that file.
Errors of type IOError are used by the IO monad. This is an abstract type; the module
System.IO.Error provides functions to interrogate and construct values of type IOError.
The Maybe type encapsulates an optional value. A value of type Maybe a either contains a value of
type a (represented as Just a), or it is empty (represented as Nothing). Using Maybe is a good way
to deal with errors or exceptional cases without resorting to drastic measures such as error.
The Maybe type is also a monad. It is a simple kind of error monad, where all errors are represented
by Nothing. A richer error monad can be built using the Data.Either.Either type
The character type Char is an enumeration whose values represent Unicode (or equivalently ISO/IEC
10646) characters (see http://www.unicode.org/ for details). This set extends the ISO 8859-1
(Latin-1) character set (the first 256 charachers), which is itself an extension of the ASCII character set
(the first 128 characters). A character literal in Haskell has type Char.
To convert a Char to or from the corresponding Int value defined by Unicode, use Prelude.toEnum
and Prelude.fromEnum from the Prelude.Enum class respectively (or equivalently ord and chr).
A String is a list of characters. String constants in Haskell are values of type String.
A fixed-precision integer type with at least the range [-2^29 .. 2^29-1].
The exact range for a given implementation can be determined by using minBound and maxBound from the Bounded class.
Instances
| Bits Int # | |
| Bounded Int # | |
| Enum Int # | |
| Eq Int # | |
| Ix Int # | |
| Ord Int # | |
| Storable Int # | |
Defined in Foreign.Storable | |
| Integral Int # | |
| Num Int # | |
| Real Int # | |
Defined in NumHierarchy Methods toRational :: Int -> Rational # | |
| Read Int # | |
| Show Int # | |
Instances
| Bits Integer # | |
Defined in Data.Bits Methods (.&.) :: Integer -> Integer -> Integer # (.|.) :: Integer -> Integer -> Integer # xor :: Integer -> Integer -> Integer # complement :: Integer -> Integer # shift :: Integer -> Int -> Integer # rotate :: Integer -> Int -> Integer # setBit :: Integer -> Int -> Integer # clearBit :: Integer -> Int -> Integer # complementBit :: Integer -> Int -> Integer # testBit :: Integer -> Int -> Bool # shiftL :: Integer -> Int -> Integer # shiftR :: Integer -> Int -> Integer # | |
| Enum Integer # | |
| Eq Integer # | |
| Ix Integer # | |
| Ord Integer # | |
| Integral Integer # | |
Defined in NumHierarchy | |
| Num Integer # | |
| Real Integer # | |
Defined in NumHierarchy Methods toRational :: Integer -> Rational # | |
| Read Integer # | |
| Show Integer # | |
Instances
| Enum Float # | |
| Eq Float # | |
| Ord Float # | |
| Storable Float # | |
| Floating Float # | |
| Fractional Float # | |
| Num Float # | |
| Real Float # | |
Defined in NumHierarchy Methods toRational :: Float -> Rational # | |
| RealFloat Float # | |
Defined in NumHierarchy Methods floatRadix :: Float -> Integer # floatDigits :: Float -> Int # floatRange :: Float -> (Int, Int) # decodeFloat :: Float -> (Integer, Int) # encodeFloat :: Integer -> Int -> Float # significand :: Float -> Float # scaleFloat :: Int -> Float -> Float # isInfinite :: Float -> Bool # isDenormalized :: Float -> Bool # isNegativeZero :: Float -> Bool # | |
| RealFrac Float # | |
| Read Float # | |
| Show Float # | |
Instances
| Enum Double # | |
Defined in Data.Enum | |
| Eq Double # | |
| Ord Double # | |
| Storable Double # | |
| Floating Double # | |
| Fractional Double # | |
| Num Double # | |
| Real Double # | |
Defined in NumHierarchy Methods toRational :: Double -> Rational # | |
| RealFloat Double # | |
Defined in NumHierarchy Methods floatRadix :: Double -> Integer # floatDigits :: Double -> Int # floatRange :: Double -> (Int, Int) # decodeFloat :: Double -> (Integer, Int) # encodeFloat :: Integer -> Int -> Double # significand :: Double -> Double # scaleFloat :: Int -> Double -> Double # isInfinite :: Double -> Bool # isDenormalized :: Double -> Bool # isNegativeZero :: Double -> Bool # | |
| RealFrac Double # | |
| Read Double # | |
| Show Double # | |
type Rational = Ratio Integer #
Arbitrary-precision rational numbers, represented as a ratio of two Integer values. A rational number
may be constructed using the % operator.
A value of type IO a is a computation which, when performed, does some I/O before returning a value
of type a.
There is really only one way to "perform" an I/O action: bind it to Main.main in your program. When
your program is run, the IO will be performed. It isn’t possible to perform IO from an arbitrary
function, unless that function is itself in the IO monad and called at some point, directly or indirectly,
from Main.main.
IO is a monad, so IO actions can be combined using either the do-notation or the >> and >>= operations
from the Monad class.
Instances
| Eq Bool # | |
| Eq GeneralCategory # | |
Defined in Data.Char Methods (==) :: GeneralCategory -> GeneralCategory -> Bool # (/=) :: GeneralCategory -> GeneralCategory -> Bool # | |
| Eq Int # | |
| Eq Int16 # | |
| Eq Int32 # | |
| Eq Int64 # | |
| Eq Int8 # | |
| Eq Ordering # | |
| Eq Word # | |
| Eq Word16 # | |
| Eq Word32 # | |
| Eq Word64 # | |
| Eq Word8 # | |
| Eq Errno # | |
| Eq CChar # | |
| Eq CClock # | |
| Eq CDouble # | |
| Eq CFloat # | |
| Eq CInt # | |
| Eq CIntMax # | |
| Eq CIntPtr # | |
| Eq CLLong # | |
| Eq CLong # | |
| Eq CPtrdiff # | |
| Eq CSChar # | |
| Eq CShort # | |
| Eq CSigAtomic # | |
Defined in Foreign.C.Types | |
| Eq CSize # | |
| Eq CTime # | |
| Eq CUChar # | |
| Eq CUInt # | |
| Eq CUIntMax # | |
| Eq CUIntPtr # | |
| Eq CULLong # | |
| Eq CULong # | |
| Eq CUShort # | |
| Eq CWchar # | |
| Eq IntPtr # | |
| Eq WordPtr # | |
| Eq Char # | |
| Eq Double # | |
| Eq Float # | |
| Eq Integer # | |
| Eq ExitCode # | |
| Eq BufferMode # | |
Defined in System.IO | |
| Eq Handle # | |
| Eq HandlePosn # | |
Defined in System.IO | |
| Eq IOMode # | |
| Eq SeekMode # | |
| Eq IOErrorType # | |
Defined in System.IO.Error | |
| Eq () # | |
| Eq a => Eq (Complex a) # | |
| Eq a => Eq (Maybe a) # | |
| Eq (ForeignPtr a) # | |
Defined in Foreign.ForeignPtr | |
| Eq (FunPtr a) # | |
| Eq (Ptr a) # | |
| Eq (StablePtr a) # | |
| Integral a => Eq (Ratio a) # | |
| (Ix i, Eq e) => Eq (Array i e) # | |
| (Eq a, Eq b) => Eq (a, b) # | |
| (Eq a, Eq b, Eq c) => Eq (a, b, c) # | |
| (Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d) # | |
| (Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e) # | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (a, b, c, d, e, f) # | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (a, b, c, d, e, f, g) # | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => Eq (a, b, c, d, e, f, g, h) # | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i) => Eq (a, b, c, d, e, f, g, h, i) # | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j) => Eq (a, b, c, d, e, f, g, h, i, j) # | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k) => Eq (a, b, c, d, e, f, g, h, i, j, k) # | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l) => Eq (a, b, c, d, e, f, g, h, i, j, k, l) # | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m) # | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n) # | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) # | |
Methods
compare :: a -> a -> Ordering #
(<) :: a -> a -> Bool infix 4 #
(<=) :: a -> a -> Bool infix 4 #
(>=) :: a -> a -> Bool infix 4 #
Instances
| Ord Bool # | |
| Ord GeneralCategory # | |
Defined in Data.Char Methods compare :: GeneralCategory -> GeneralCategory -> Ordering # (<) :: GeneralCategory -> GeneralCategory -> Bool # (<=) :: GeneralCategory -> GeneralCategory -> Bool # (>=) :: GeneralCategory -> GeneralCategory -> Bool # (>) :: GeneralCategory -> GeneralCategory -> Bool # max :: GeneralCategory -> GeneralCategory -> GeneralCategory # min :: GeneralCategory -> GeneralCategory -> GeneralCategory # | |
| Ord Int # | |
| Ord Int16 # | |
| Ord Int32 # | |
| Ord Int64 # | |
| Ord Int8 # | |
| Ord Ordering # | |
Defined in Data.Ord | |
| Ord Word # | |
| Ord Word16 # | |
| Ord Word32 # | |
| Ord Word64 # | |
| Ord Word8 # | |
| Ord CChar # | |
| Ord CClock # | |
| Ord CDouble # | |
| Ord CFloat # | |
| Ord CInt # | |
| Ord CIntMax # | |
| Ord CIntPtr # | |
| Ord CLLong # | |
| Ord CLong # | |
| Ord CPtrdiff # | |
Defined in Foreign.C.Types | |
| Ord CSChar # | |
| Ord CShort # | |
| Ord CSigAtomic # | |
Defined in Foreign.C.Types Methods compare :: CSigAtomic -> CSigAtomic -> Ordering # (<) :: CSigAtomic -> CSigAtomic -> Bool # (<=) :: CSigAtomic -> CSigAtomic -> Bool # (>=) :: CSigAtomic -> CSigAtomic -> Bool # (>) :: CSigAtomic -> CSigAtomic -> Bool # max :: CSigAtomic -> CSigAtomic -> CSigAtomic # min :: CSigAtomic -> CSigAtomic -> CSigAtomic # | |
| Ord CSize # | |
| Ord CTime # | |
| Ord CUChar # | |
| Ord CUInt # | |
| Ord CUIntMax # | |
Defined in Foreign.C.Types | |
| Ord CUIntPtr # | |
Defined in Foreign.C.Types | |
| Ord CULLong # | |
| Ord CULong # | |
| Ord CUShort # | |
| Ord CWchar # | |
| Ord IntPtr # | |
| Ord WordPtr # | |
| Ord Char # | |
| Ord Double # | |
| Ord Float # | |
| Ord Integer # | |
| Ord ExitCode # | |
Defined in System.Exit | |
| Ord BufferMode # | |
Defined in System.IO Methods compare :: BufferMode -> BufferMode -> Ordering # (<) :: BufferMode -> BufferMode -> Bool # (<=) :: BufferMode -> BufferMode -> Bool # (>=) :: BufferMode -> BufferMode -> Bool # (>) :: BufferMode -> BufferMode -> Bool # max :: BufferMode -> BufferMode -> BufferMode # min :: BufferMode -> BufferMode -> BufferMode # | |
| Ord IOMode # | |
| Ord SeekMode # | |
Defined in System.IO | |
| Ord () # | |
| Ord a => Ord (Maybe a) # | |
| Ord (ForeignPtr a) # | |
Defined in Foreign.ForeignPtr Methods compare :: ForeignPtr a -> ForeignPtr a -> Ordering # (<) :: ForeignPtr a -> ForeignPtr a -> Bool # (<=) :: ForeignPtr a -> ForeignPtr a -> Bool # (>=) :: ForeignPtr a -> ForeignPtr a -> Bool # (>) :: ForeignPtr a -> ForeignPtr a -> Bool # max :: ForeignPtr a -> ForeignPtr a -> ForeignPtr a # min :: ForeignPtr a -> ForeignPtr a -> ForeignPtr a # | |
| Ord (FunPtr a) # | |
Defined in Foreign.Ptr | |
| Ord (Ptr a) # | |
| Integral a => Ord (Ratio a) # | |
| (Ix i, Ord e) => Ord (Array i e) # | |
| (Ord a, Ord b) => Ord (a, b) # | |
| (Ord a, Ord b, Ord c) => Ord (a, b, c) # | |
| (Ord a, Ord b, Ord c, Ord d) => Ord (a, b, c, d) # | |
Defined in Data.Ord | |
| (Ord a, Ord b, Ord c, Ord d, Ord e) => Ord (a, b, c, d, e) # | |
Defined in Data.Ord Methods compare :: (a, b, c, d, e) -> (a, b, c, d, e) -> Ordering # (<) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool # (<=) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool # (>=) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool # (>) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool # max :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) # min :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) # | |
| (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f) => Ord (a, b, c, d, e, f) # | |
Defined in Data.Ord Methods compare :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Ordering # (<) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool # (<=) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool # (>=) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool # (>) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool # max :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) # min :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) # | |
| (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g) => Ord (a, b, c, d, e, f, g) # | |
Defined in Data.Ord Methods compare :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Ordering # (<) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool # (<=) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool # (>=) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool # (>) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool # max :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) # min :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) # | |
| (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h) => Ord (a, b, c, d, e, f, g, h) # | |
Defined in Data.Ord Methods compare :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Ordering # (<) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool # (<=) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool # (>=) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool # (>) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool # max :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) # min :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) # | |
| (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i) => Ord (a, b, c, d, e, f, g, h, i) # | |
Defined in Data.Ord Methods compare :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool # max :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) # min :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) # | |
| (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j) => Ord (a, b, c, d, e, f, g, h, i, j) # | |
Defined in Data.Ord Methods compare :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) # min :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) # | |
| (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k) => Ord (a, b, c, d, e, f, g, h, i, j, k) # | |
Defined in Data.Ord Methods compare :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) # min :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) # | |
| (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l) => Ord (a, b, c, d, e, f, g, h, i, j, k, l) # | |
Defined in Data.Ord Methods compare :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) # min :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) # | |
| (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m) # | |
Defined in Data.Ord Methods compare :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) # min :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) # | |
| (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n) # | |
Defined in Data.Ord Methods compare :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) # min :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) # | |
| (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n, Ord o) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) # | |
Defined in Data.Ord Methods compare :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) # min :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) # | |
Methods
enumFromThen :: a -> a -> [a] #
enumFromTo :: a -> a -> [a] #
enumFromThenTo :: a -> a -> a -> [a] #
Instances
Instances
class (Eq a, Show a) => Num a where #
Methods
fromInteger :: Integer -> a #
Instances
| Num Int # | |
| Num Int16 # | |
| Num Int32 # | |
| Num Int64 # | |
| Num Int8 # | |
| Num Word # | |
| Num Word16 # | |
| Num Word32 # | |
| Num Word64 # | |
| Num Word8 # | |
| Num CChar # | |
| Num CClock # | |
| Num CDouble # | |
| Num CFloat # | |
| Num CInt # | |
| Num CIntMax # | |
| Num CIntPtr # | |
| Num CLLong # | |
| Num CLong # | |
| Num CPtrdiff # | |
| Num CSChar # | |
| Num CShort # | |
| Num CSigAtomic # | |
Defined in Foreign.C.Types Methods (+) :: CSigAtomic -> CSigAtomic -> CSigAtomic # (-) :: CSigAtomic -> CSigAtomic -> CSigAtomic # (*) :: CSigAtomic -> CSigAtomic -> CSigAtomic # negate :: CSigAtomic -> CSigAtomic # abs :: CSigAtomic -> CSigAtomic # signum :: CSigAtomic -> CSigAtomic # fromInteger :: Integer -> CSigAtomic # | |
| Num CSize # | |
| Num CTime # | |
| Num CUChar # | |
| Num CUInt # | |
| Num CUIntMax # | |
| Num CUIntPtr # | |
| Num CULLong # | |
| Num CULong # | |
| Num CUShort # | |
| Num CWchar # | |
| Num IntPtr # | |
| Num WordPtr # | |
| Num Double # | |
| Num Float # | |
| Num Integer # | |
| RealFloat a => Num (Complex a) # | |
| Integral a => Num (Ratio a) # | |
class (Num a, Ord a) => Real a where #
Methods
toRational :: a -> Rational #
Instances
class (Real a, Enum a) => Integral a where #
Instances
class Num a => Fractional a where #
Instances
| Fractional CDouble # | |
| Fractional CFloat # | |
| Fractional Double # | |
| Fractional Float # | |
| RealFloat a => Fractional (Complex a) # | |
| Integral a => Fractional (Ratio a) # | |
class Fractional a => Floating a where #
Instances
| Floating CDouble # | |
| Floating CFloat # | |
| Floating Double # | |
| Floating Float # | |
| RealFloat a => Floating (Complex a) # | |
Defined in Data.Complex Methods 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 # | |
class (Real a, Fractional a) => RealFrac a where #
Methods
properFraction :: Integral b => a -> (b, a) #
truncate :: Integral b => a -> b #
round :: Integral b => a -> b #
class (RealFrac a, Floating a) => RealFloat a where #
Methods
floatRadix :: a -> Integer #
floatDigits :: a -> Int #
floatRange :: a -> (Int, Int) #
decodeFloat :: a -> (Integer, Int) #
encodeFloat :: Integer -> Int -> a #
significand :: a -> a #
scaleFloat :: Int -> a -> a #
isInfinite :: a -> Bool #
isDenormalized :: a -> Bool #
isNegativeZero :: a -> Bool #
Instances
class 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.
Minimal complete definition: >>= and return.
Instances of Monad should satisfy the following laws:
return a >>= k == k a m >>= return == m m >>= (x -> k x >>= h) == (m >>= k) >>= h
Instances of both Monad and Functor should additionally satisfy the law:
fmap f xs == xs >>= return . f
The instances of Monad for lists, Maybe and IO defined in the Prelude
satisfy these laws.
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.
Inject a value into the monadic type.
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.
class Functor (f :: Type -> Type) where #
The Functor class is used for types that can be mapped over. Instances of Functor should satisfy the following laws:
fmap id == id fmap (f . g) == fmap f . fmap g
The instances of Functor for lists, Maybe and IO satisfy these laws.
Instances
| Functor Maybe # | |
Defined in Control.Monad | |
| Functor IO # | |
Defined in Control.Monad | |
| Functor [] # | |
Defined in Control.Monad | |
| Ix i => Functor (Array i) # | |
Defined in Control.Monad | |
sequence :: Monad m => [m a] -> m [a] #
Evaluate each action in the sequence from left to right, and collect the results.
sequence_ :: Monad m => [m a] -> m () #
Evaluate each action in the sequence from left to right, and ignore the results.
(=<<) :: Monad m => (a -> m b) -> m a -> m b infixr 1 #
Same as >>=, but with the arguments interchanged.
maybe :: b -> (a -> b) -> Maybe a -> b #
The maybe function takes a default value, a function, and a Maybe value. If the Maybe value is
Nothing, the function returns the default value. Otherwise, it applies the function to the value inside
the Just and returns the result.
(^^) :: (Fractional a, Integral b) => a -> b -> a infixr 8 #
fromIntegral :: (Integral a, Num b) => a -> b #
realToFrac :: (Real a, Fractional b) => a -> b #