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