1 {-# OPTIONS_GHC -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
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,
36 fst, snd, curry, uncurry,
39 []((:), []), -- Not legal Haskell 98;
40 -- ... available through built-in syntax
41 module Data.Tuple, -- Includes tuple types
42 ()(..), -- Not legal Haskell 98
43 (->), -- ... available through built-in syntax
46 (:), -- Not legal Haskell 98
49 -- ** Basic type classes
51 Ord(compare, (<), (<=), (>=), (>), max, min),
52 Enum(succ, pred, toEnum, fromEnum, enumFrom, enumFromThen,
53 enumFromTo, enumFromThenTo),
54 Bounded(minBound, maxBound),
59 Int, Integer, Float, Double,
62 -- *** Numeric type classes
63 Num((+), (-), (*), negate, abs, signum, fromInteger),
65 Integral(quot, rem, div, mod, quotRem, divMod, toInteger),
66 Fractional((/), recip, fromRational),
67 Floating(pi, exp, log, sqrt, (**), logBase, sin, cos, tan,
68 asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh),
69 RealFrac(properFraction, truncate, round, ceiling, floor),
70 RealFloat(floatRadix, floatDigits, floatRange, decodeFloat,
71 encodeFloat, exponent, significand, scaleFloat, isNaN,
72 isInfinite, isDenormalized, isIEEE, isNegativeZero, atan2),
74 -- *** Numeric functions
75 subtract, even, odd, gcd, lcm, (^), (^^),
76 fromIntegral, realToFrac,
78 -- ** Monads and functors
79 Monad((>>=), (>>), return, fail),
81 mapM, mapM_, sequence, sequence_, (=<<),
86 -- ** Miscellaneous functions
87 id, const, (.), flip, ($), until,
88 asTypeOf, error, undefined,
93 head, last, tail, init, null, length, (!!),
95 -- ** Reducing lists (folds)
96 foldl, foldl1, foldr, foldr1,
104 scanl, scanl1, scanr, scanr1,
105 -- *** Infinite lists
106 iterate, repeat, replicate, cycle,
108 take, drop, splitAt, takeWhile, dropWhile, span, break,
109 -- ** Searching lists
110 elem, notElem, lookup,
111 -- ** Zipping and unzipping lists
112 zip, zip3, zipWith, zipWith3, unzip, unzip3,
113 -- ** Functions on strings
114 lines, words, unlines, unwords,
116 -- * Converting to and from @String@
117 -- ** Converting to @String@
119 Show(showsPrec, showList, show),
121 showChar, showString, showParen,
122 -- ** Converting from @String@
124 Read(readsPrec, readList),
125 reads, readParen, read, lex,
127 -- * Basic Input and output
129 -- ** Simple I\/O operations
130 -- All I/O functions defined here are character oriented. The
131 -- treatment of the newline character will vary on different systems.
132 -- For example, two characters of input, return and linefeed, may
133 -- read as a single newline character. These functions cannot be
134 -- used portably for binary I/O.
135 -- *** Output functions
137 putStr, putStrLn, print,
138 -- *** Input functions
140 getLine, getContents, interact,
143 readFile, writeFile, appendFile, readIO, readLn,
144 -- ** Exception handling in the I\/O monad
145 IOError, ioError, userError, catch
163 #ifdef __GLASGOW_HASKELL__
173 import GHC.Err ( error, undefined )
183 -- -----------------------------------------------------------------------------
184 -- Miscellaneous functions
186 -- | Strict (call-by-value) application, defined in terms of 'seq'.
187 ($!) :: (a -> b) -> a -> b
192 -- | The value of @'seq' a b@ is bottom if @a@ is bottom, and otherwise
193 -- equal to @b@. 'seq' is usually introduced to improve performance by
194 -- avoiding unneeded laziness.