1 {-# OPTIONS -fno-implicit-prelude #-}
2 -----------------------------------------------------------------------------
5 -- Copyright : (c) The University of Glasgow 2001
6 -- License : BSD-style (see the file libraries/base/LICENSE)
8 -- Maintainer : libraries@haskell.org
9 -- Stability : provisional
10 -- Portability : portable
12 -- The Prelude: a standard module imported by default into all Haskell
13 -- modules. For more documentation, see the Haskell 98 Report
14 -- <http://www.haskell.org/onlinereport/>.
16 -----------------------------------------------------------------------------
20 -- * Standard types, classes and related functions
22 -- ** Basic data types
24 (&&), (||), not, otherwise,
37 fst, snd, curry, uncurry,
40 []((:), []), -- Not legal Haskell 98;
41 -- ... available through built-in syntax
42 module Data.Tuple, -- Includes tuple types
43 ()(..), -- Not legal Haskell 98
44 (->), -- ... available through built-in syntax
47 (:), -- Not legal Haskell 98
50 -- ** Basic type classes
52 Ord(compare, (<), (<=), (>=), (>), max, min),
53 Enum(succ, pred, toEnum, fromEnum, enumFrom, enumFromThen,
54 enumFromTo, enumFromThenTo),
55 Bounded(minBound, maxBound),
60 Int, Integer, Float, Double,
63 -- *** Numeric type classes
64 Num((+), (-), (*), negate, abs, signum, fromInteger),
66 Integral(quot, rem, div, mod, quotRem, divMod, toInteger),
67 Fractional((/), recip, fromRational),
68 Floating(pi, exp, log, sqrt, (**), logBase, sin, cos, tan,
69 asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh),
70 RealFrac(properFraction, truncate, round, ceiling, floor),
71 RealFloat(floatRadix, floatDigits, floatRange, decodeFloat,
72 encodeFloat, exponent, significand, scaleFloat, isNaN,
73 isInfinite, isDenormalized, isIEEE, isNegativeZero, atan2),
75 -- *** Numeric functions
76 subtract, even, odd, gcd, lcm, (^), (^^),
77 fromIntegral, realToFrac,
79 -- ** Monads and functors
80 Monad((>>=), (>>), return, fail),
82 mapM, mapM_, sequence, sequence_, (=<<),
84 -- ** Miscellaneous functions
85 id, const, (.), flip, ($), until,
86 asTypeOf, error, undefined,
91 head, last, tail, init, null, length, (!!),
93 -- ** Reducing lists (folds)
94 foldl, foldl1, foldr, foldr1,
102 scanl, scanl1, scanr, scanr1,
103 -- *** Infinite lists
104 iterate, repeat, replicate, cycle,
106 take, drop, splitAt, takeWhile, dropWhile, span, break,
107 -- ** Searching lists
108 elem, notElem, lookup,
109 -- ** Zipping and unzipping lists
110 zip, zip3, zipWith, zipWith3, unzip, unzip3,
111 -- ** Functions on strings
112 lines, words, unlines, unwords,
114 -- * Converting to and from @String@
116 Read(readsPrec, readList),
117 Show(showsPrec, showList, show),
118 reads, shows, read, lex,
119 showChar, showString, readParen, showParen,
121 -- * Basic Input and output
122 -- ** Simple I\/O operations
123 -- All I/O functions defined here are character oriented. The
124 -- treatment of the newline character will vary on different systems.
125 -- For example, two characters of input, return and linefeed, may
126 -- read as a single newline character. These functions cannot be
127 -- used portably for binary I/O.
128 -- *** Output functions
130 putStr, putStrLn, print,
131 -- *** Input functions
133 getLine, getContents, interact,
136 readFile, writeFile, appendFile, readIO, readLn,
137 -- ** Exception handling in the I\/O monad
138 IOError, ioError, userError, catch
154 #ifdef __GLASGOW_HASKELL__
164 import GHC.Err ( error, undefined )
175 -- -----------------------------------------------------------------------------
176 -- Miscellaneous functions
178 ($!) :: (a -> b) -> a -> b