data () = () deriving (Eq, Ord, Enum, Bounded) (see 6.1.5) Instances: Read Show data [a] = [] | a : [a] deriving (Eq, Ord) (see 6.1.3) Instances: Read Show Functor Monad data (a,b) = (a,b) deriving (Eq, Ord, Bounded) (see 6.1.4) Instances: Read Show data a->b (see 6.1.6) data Bool = False | True deriving (Eq, Ord, Enum, Read, Show, Bounded) (see 6.1.1) data Char (see 6.1.2) Instances: Eq Ord Enum Read Show data Double (see 6.4) Instances: Eq Ord Enum Read Show Num Real Fractional RealFrac Floating RealFloat data Either a b e= Left a | Right b deriving (Eq, Ord, Read, Show) (see 6.1.8) type FilePath = String (see 7.1) data Float (see 6.4) Instances: Eq Ord Enum Read Show Num Real Fractional RealFrac Floating RealFloat data Int (see 6.4) Instances: Eq Ord Enum Read Show Num Real Integral Bounded data Integer (see 6.4) Instances: Eq Ord Enum Read Show Num Real Integral data IO a (see 6.1.7) Instances: Functor Monad data IOError (see 6.1.7) Instances: Show Eq data Maybe a = Nothing | Just a deriving (Eq, Ord, Read, Show) (see 6.1.8) Instances: Functor Monad data Ordering = LT | EQ | GT deriving (Eq, Ord, Enum, Read, Show, Bounded) (see 6.1.8) type ReadS a = String -> [(a,String)] (see 6.3.3) type ShowS = String -> String (see 6.3.3) type String = [Char] (see 6.1.2)
[] : (,) EQ False GT Just Left LT Nothing Right True
class Bounded a (see 6.3.7) class Enum a (see 6.3.4) class Eq a (see 6.3.1) class (Fractional a) => Floating a (see 6.4) class (Num a) => Fractional a (see 6.4) class Functor f (see 6.3.5) class (Real a, Enum a) => Integral a (see 6.4) class Monad m (see 6.3.6) class (Eq a, Show a) => Num a (see 6.4) class (Eq a) => Ord a (see 6.3.2) class Read a (see 6.3.3) class (Num a, Ord a) => Real a (see 6.4) class (RealFrac a, Floating a) => RealFloat a (see 6.4) class (Real a, Fractional a) => RealFrac a (see 6.4) class Show a (see 6.3.3)
(!!) :: [a] -> Int -> a | [0,1,2] !! 1 = 1 |
($) :: (a -> b) -> a -> b | f x $ g y = f x (g y) |
($!) :: (a -> b) -> (a -> b) | (see 6.2) |
(&&) :: Bool -> Bool -> Bool | Boolean `and' |
(||) :: Bool -> Bool -> Bool | Boolean `or' |
(*) :: Num a => a -> a -> a | |
(**) :: Floating a => a -> a -> a | |
(+) :: Num a => a -> a -> a | |
(++) :: [a] -> [a] -> [a] | "abc" ++ "def" = "abcdef" |
(-) :: Num a => a -> a -> a | |
(.) :: (b -> c) -> (a -> b) -> a -> c | Function composition |
(/) :: Fractional a => a -> a -> a | |
(/=) :: Eq a => a -> a -> Bool | not equal |
(<) :: Ord a => a -> a -> Bool | |
(<=) :: Ord a => a -> a -> Bool | |
(==) :: Eq a => a -> a -> Bool | |
(=<<) :: Monad a => (a -> m b) -> m a -> m b | Monadic binding (see 6.3.6) |
(>) :: Ord a => a -> a -> Bool | |
(>=) :: Ord a => a -> a -> Bool | |
(>>) :: Monad m => m a -> m b -> m b | Monadic binding (see 6.3.6) |
(>>=) :: Monad m => m a -> (a -> m b) -> m b | Monadic binding (see 6.3.6) |
(^) :: (Num a, Integral b) => a -> b -> a | |
(^^) :: (Fractional a, Integral b) => a -> b -> a | negative exponent allowed |
abs :: Num a => a -> a | |
acos :: Floating a => a -> a | |
acosh :: Floating a => a -> a | |
all :: (a -> Bool) -> [a] -> Bool | all (/= 'a') "cba" = False |
and :: [Bool] -> Bool | and [True, True, True] = True |
any :: (a -> Bool) -> [a] -> Bool | any (== 'c') "abc" = True |
appendFile :: FilePath -> String -> IO () | |
applyM :: Monad m => (a -> m b) -> m a -> m b | |
asTypeOf :: a -> a -> a | Sort of a type cast |
asin :: Floating a => a -> a | |
asinh :: Floating a => a -> a | |
atan :: Floating a => a -> a | |
atan2 :: RealFrac a => a -> a | |
atanh :: Floating a => a -> a | |
break :: (a -> Bool) -> [a] -> ([a], [a]) | break (<2) [1,2,3] = ([1],[2,3]) |
catch :: IO a -> (IOError -> IO a) -> IO a | |
ceiling :: (RealFrac a, Integral b) => a -> b | |
compare :: Ord a => a -> a -> Ordering | |
concat :: MonadPlus m => [m a] -> m a | concat ["a","bc","d"] = "abcd" |
concatMap :: (a -> [b]) -> [a] -> [b] | |
const :: a -> b -> a | |
cos :: Floating a => a -> a | |
cosh :: Floating a => a -> a | |
curry :: ((a, b) -> c) -> a -> b -> c | |
cycle :: [a] -> [a] | cycle "abc" = "abcabcabc ..." |
decodeFloat :: RealFloat a => a -> (Integer, Int) | |
div :: Integral a => a -> a -> a | |
divMod :: Integral a => a -> a -> (a, a) | |
drop :: Int -> [a] -> [a] | drop 2 "abcd" = "cd" |
dropWhile :: (a -> Bool) -> [a] -> [a] | dropWhile (>3) [5,3,5] = [3,5] |
elem :: Eq a => a -> [a] -> Bool | 'a' `elem` "abc" = True |
encodeFloat :: RealFloat a => Integer -> Int -> a | |
enumFrom :: Enum a => a -> [a] | [n..] |
enumFromThen :: Enum a => a -> a -> [a] | [m,n..] |
enumFromThenTo :: Enum a => a -> a -> a -> [a] | [m,n..o] |
enumFromTo :: Enum a => a -> a -> [a] | [m..n] |
error :: String -> a | (see 3.1) |
even :: Integral a => a -> Bool | |
exp :: Floating a => a -> a | |
exponent :: RealFloat a => a -> Int | |
fail :: Monad m => String -> m a | |
filter :: (a -> Bool) -> [a] -> [a] | |
flip :: (a -> b -> c) -> (b -> a -> c) | |
floatDigits :: RealFloat a => a -> Int | |
floatRadix :: RealFloat a => a -> Integer | |
floatRange :: RealFloat a => a -> (Int, Int) | |
floor :: (RealFrac a, Integral b) => a -> b | |
fmap :: Functor f => (a -> b) -> f a -> f b | |
foldl :: (a -> b -> a) -> a -> [b] -> a | foldl (+) 0 [a,b,c] = ((0+a)+b)+c |
foldl1 :: (a -> a -> a) -> [a] -> a | foldl1 (+) [a,b,c] = (a+b)+c |
foldr :: (a -> b -> b) -> b -> [a] -> b | foldr (+) 0 [a,b,c] = a+(b+(c+0)) |
foldr1 :: (a -> a -> a) -> [a] -> a | foldr1 (+) [a,b,c] = a+(b+c) |
fromEnum :: Enum a => a -> Int | |
fromInteger :: Num a => Integer -> a | (see 3.2) |
fromIntegral :: (Integral a, Num b) => a -> b | |
fromRational :: Fractional a => Rational -> a | (see 3.2) |
fst :: (a, b) -> a | |
gcd :: (Integral a) => a -> a -> a | |
getChar :: IO Char | eof generates an IOError |
getContents :: IO String | |
getLine :: IO String | eof generates an IOError |
head :: [a] -> a | |
id :: a -> a | |
init :: [a] -> [a] | init "abcd" = "abc" |
interact :: (String -> String) -> IO () | |
ioError :: IOError -> IO a | |
isDenormalized :: RealFloat a => a -> Bool | |
isIEEE :: RealFloat a => a -> Bool | |
isInfinite :: RealFloat a => a -> Bool | |
isNaN :: RealFloat a => a -> Bool | |
isNegativeZero :: RealFloat a => a -> Bool | |
iterate :: (a -> a) -> a -> [a] | iterate (++ " ") "" = ["", " ", " ",...] |
last :: [a] -> a | last "abcde" = "e" |
lcm :: Integral a => a -> a -> a | |
length :: [a] -> Int | length "Abc" = 3 |
lex :: ReadS String | lex "abc def" = [("abc"," def")] |
lines :: String -> [String] | |
log :: Floating a => a -> a | |
logBase :: Floating a => a -> a -> a | |
lookup :: Eq a => a -> [(a, b)] -> Maybe b | |
map :: (a -> b) -> [a] -> [b] | |
mapM :: Monad m => (a -> m b) -> [a] -> m [b] | |
mapM_ :: Monad m => (a -> m b) -> [a] -> m () | |
max :: Ord a => a -> a -> a | |
maxBound :: Bounded a => a | |
maximum :: Ord a => [a] -> a | |
maybe :: b -> (a -> b) -> Maybe a -> b | maybe 0 (+1) (Just 1) = 2 |
min :: Ord a => a -> a -> a | |
minBound :: Bounded a => a | |
minimum :: Ord a => [a] -> a | |
mod :: Integral a => a -> a -> a | |
negate :: Num a => a -> a | |
not :: Bool -> Bool | |
notElem :: Eq a => a -> [a] -> Bool | |
null :: [a] -> Bool | |
odd :: Integral a => a -> Bool | |
or :: [Bool] -> Bool | |
otherwise :: Bool | |
pi :: Floating a => a | |
pred :: Enum a => a -> a | pred True = False |
print :: Show a => IO () | adds a newline |
product :: Num a => [a] -> a | |
properFraction :: (RealFrac a, Integral b) => a -> (b, a) | |
putChar :: Char -> IO () | |
putStr :: String -> IO () | |
putStrLn :: String -> IO () | adds a newline |
quot :: Integral a => a -> a -> a | |
quotRem :: Integral a => a -> a -> (a, a) | |
read :: Read a => String -> a | |
readFile :: FilePath -> IO String | |
readIO :: Read a => String -> IO a | fails with IOError |
readList :: Read a => ReadS [a] | |
readLn :: Read a => IO a | |
readParen :: Bool -> ReadS a -> ReadS a | |
reads :: Read a => ReadS a | reads "1 2" :: [(Int,String)] = [(1," 2")] |
readsPrec :: Read a => Int -> ReadS a | |
realToFrac :: (Real a, Fractional b) => a -> b | |
recip :: Fractional a => a -> a | |
rem :: Integral a => a -> a -> a | |
repeat :: a -> [a] | repeat 'a' = "aaaaaaaaa..." |
replicate :: Int -> a -> [a] | replicate 4 'a' = "aaaa" |
return :: Monad m => a -> m a | |
reverse :: [a] -> [a] | reverse "abc" = "cba" |
round :: (RealFrac a, Integral b) => a -> b | |
scaleFloat :: RealFloat a => Int -> a -> a | |
scanl :: (a -> b -> a) -> a -> [b] -> [a] | scanl (+) 0 [1,2,3] = [0,1,3,6] |
scanl1 :: (a -> a -> a) -> [a] -> [a] | scanl1 (+) [1,2,3] = [1,3,6] |
scanr :: (a -> b -> b) -> b -> [a] -> [b] | scanr (+) 0 [1,2,3] = [6,5,3,0] |
scanr1 :: (a -> a -> a) -> [a] -> [a] | scanr1 (+) [1,2,3] = [6,5,3] |
seq :: a -> b -> b | (see 6.2) |
sequence :: Monad m => [m a] -> m [a] | |
sequence_ :: Monad m => [m a] -> m () | do operations in sequence |
show :: Show a => a -> String | (see 6.3.3) |
showChar :: Char -> ShowS | |
showList :: Show a => [a] -> ShowS | |
showParen :: Bool -> ShowS -> ShowS | |
showString :: String -> ShowS | |
shows :: Show a => a -> ShowS | (see 6.3.3) |
showsPrec :: Show a => Int -> a -> ShowS | (see 6.3.3) |
significand :: RealFloat a => a -> a | |
signum :: Num a => a -> a | |
sin :: Floating a => a -> a | |
sinh :: Floating a => a -> a | |
snd :: (a, b) -> b | |
span :: (a -> Bool) -> [a] -> ([a], [a]) | span isAlpha "ab cd" = ("ab"," cd") |
splitAt :: Int -> [a] -> ([a], [a]) | splitAt 2 "abcdef" = ("ab","cdef") |
sqrt :: Floating a => a -> a | |
subtract :: Num a => a -> a -> a | |
succ :: Enum a => a -> a | succ False = True |
sum :: Num a => [a] -> a | sum [1,2,3] = 6 |
tail :: [a] -> [a] | tail "abc" = "bc" |
take :: Int -> [a] -> [a] | take 3 "abcde" = "abc" |
takeWhile :: (a -> Bool) -> [a] -> [a] | takeWhile (> 2) [3,2,1] = [3] |
tan :: Floating a => a -> a | |
tanh :: Floating a => a -> a | |
toEnum :: Enum a => Int -> a | toEnum 0 :: Bool = False |
toInteger :: Integral a => a -> Integer | |
toRational :: Real a => a -> Rational | |
truncate :: (RealFrac a, Integral b) => a -> b | |
uncurry :: (a -> b -> c) -> ((a, b) -> c) | |
undefined :: a | (see 3.1) |
unlines :: [String] -> String | |
until :: (a -> Bool) -> (a -> a) -> a -> a | until (> 3) (+ 2) 0 = 4 |
unwords :: [String] -> String | |
unzip :: [(a, b)] -> ([a], [b]) | unzip [('a','b'),('c','d')] = ("ac",bd") |
unzip3 :: [(a, b, c)] -> ([a], [b], [c]) | |
userError :: String -> IOError | |
words :: String -> [String] | words "ab d as+3" = ["ab","d","as+3"] |
writeFile :: FilePath -> String -> IO () | |
zip :: [a] -> [b] -> [(a, b)] | zip "abc" "de" = [('a','d'), ('b',e')] |
zip3 :: [a] -> [b] -> [c] -> [(a, b, c)] | |
zipWith :: (a -> b -> c) -> [a] -> [b] -> [c] | zipWith (+) [1,2] [3,4] = [4,6] |
zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d] |