[project @ 2002-07-04 16:22:02 by simonmar]
[packages/base.git] / Prelude.hs
1 {-# OPTIONS -fno-implicit-prelude #-}
2 -----------------------------------------------------------------------------
3 -- |
4 -- Module : Prelude
5 -- Copyright : (c) The University of Glasgow 2001
6 -- License : BSD-style (see the file libraries/base/LICENSE)
7 --
8 -- Maintainer : libraries@haskell.org
9 -- Stability : provisional
10 -- Portability : portable
11 --
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/>.
15 --
16 -----------------------------------------------------------------------------
17
18 module Prelude (
19
20 -- * Basic data types
21 Bool(..),
22 Maybe(..),
23 Either(..),
24 Ordering(..),
25 Char, String, Int, Integer, Float, Double, IO,
26 Rational,
27 []((:), []),
28
29 module Data.Tuple,
30 -- Includes tuple types + fst, snd, curry, uncurry
31 ()(..), -- The unit type
32 (->), -- functions
33
34 -- * Basic type classes
35 Eq(..),
36 Ord(..),
37 Enum(..),
38 Bounded(..),
39 Num(..),
40 Real(..),
41 Integral(..),
42 Fractional(..),
43 Floating(..),
44 RealFrac(..),
45 RealFloat(..),
46
47 -- * List operations
48 map, (++), filter, concat,
49 head, last, tail, init, null, length, (!!),
50 foldl, foldl1, scanl, scanl1, foldr, foldr1, scanr, scanr1,
51 iterate, repeat, replicate, cycle,
52 take, drop, splitAt, takeWhile, dropWhile, span, break,
53 reverse, and, or,
54 any, all, elem, notElem, lookup,
55 maximum, minimum, concatMap,
56 zip, zip3, zipWith, zipWith3, unzip, unzip3,
57
58 lines, words, unlines, unwords,
59 sum, product,
60
61 -- * Converting to and from @String@
62 ReadS, ShowS,
63 Read(readsPrec, readList),
64 Show(showsPrec, showList, show),
65 reads, shows, read, lex,
66 showChar, showString, readParen, showParen,
67
68 -- * Simple I\/O operations
69 ioError, userError, catch,
70 FilePath, IOError,
71 putChar,
72 putStr, putStrLn, print,
73 getChar,
74 getLine, getContents, interact,
75 readFile, writeFile, appendFile, readIO, readLn,
76
77 -- * Monads
78 Monad(..),
79 Functor(..),
80 mapM, mapM_, sequence, sequence_, (=<<),
81
82 -- * Miscellaneous functions
83 maybe, either,
84 (&&), (||), not, otherwise,
85 subtract, even, odd, gcd, lcm, (^), (^^),
86 fromIntegral, realToFrac,
87 --exported by Data.Tuple: fst, snd, curry, uncurry,
88 id, const, (.), flip, ($), until,
89 asTypeOf, error, undefined,
90 seq, ($!)
91
92 ) where
93
94 import Control.Monad
95 import System.IO
96 import Text.Read
97 import Text.Show
98 import Data.List
99 import Data.Either
100 import Data.Maybe
101 import Data.Bool
102 import Data.Tuple
103
104 #ifdef __GLASGOW_HASKELL__
105 import GHC.Base
106 import GHC.IOBase
107 import GHC.Exception
108 import GHC.Read
109 import GHC.Enum
110 import GHC.Num
111 import GHC.Real
112 import GHC.Float
113 import GHC.Show
114 import GHC.Conc
115 import GHC.Err ( error, undefined )
116 #endif
117
118 infixr 0 $!
119
120
121 -- -----------------------------------------------------------------------------
122 -- Miscellaneous functions
123
124 ($!) :: (a -> b) -> a -> b
125 f $! x = x `seq` f x
126
127