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