[project @ 1998-12-02 13:17:09 by simonm]
[ghc-hetmet.git] / ghc / lib / std / Prelude.lhs
1 We add the option -fno-implicit-prelude here to tell the reader that
2 special names such as () and -> shouldn't be resolved to Prelude.()
3 and Prelude.-> (as they are normally). -- SDM 8/10/97
4
5 \begin{code}
6 {-# OPTIONS -fno-implicit-prelude #-}
7
8 module Prelude (
9
10         -- Everything from these modules
11     module PrelList,
12     module PrelTup,
13
14         -- From PrelBase
15     (->),
16     Eq(..), 
17     Ord(..), Ordering(..), 
18     Bounded(..), 
19     Enum(..), succ, pred, 
20     Show(..), ShowS, shows, show, showChar, showString, showParen,
21     Eval(..), seq, strict,
22     Bool(..), (&&), (||), not, otherwise,
23     Char, String, Int, Integer, Float, Double, Void,
24     Maybe(..), maybe,
25     Either(..), either,
26     ()(..),             -- The unit type
27
28     
29     id, const, (.), flip, ($), until, asTypeOf, undefined,
30
31         -- From Error
32     error,
33
34         -- From Monad
35     Functor(..), Monad(..), MonadZero(..), MonadPlus(..),
36     accumulate, sequence, mapM, mapM_, guard, filter, concat, applyM,
37
38         -- From PrelRead
39     ReadS, Read(readsPrec, readList),
40     reads, read, lex, readParen, 
41
42         -- From IO
43     IO, FilePath, IOError,
44     fail, userError, catch,
45     putChar, putStr, putStrLn, print,
46     getChar, getLine, getContents, interact,
47     readFile, writeFile, appendFile, readIO, readLn,
48
49         -- From PrelNum
50     Ratio, Rational, 
51     (%), numerator, denominator, approxRational,
52
53     Num((+), (-), (*), negate, abs, signum, fromInteger, fromInt{-glaExt-}),
54     Real(toRational),
55     Integral(quot, rem, div, mod, quotRem, divMod, toInteger, toInt{-partain-}),
56     Fractional((/), recip, fromRational),
57     Floating(pi, exp, log, sqrt, (**), logBase, sin, cos, tan,
58              asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh),
59     RealFrac(properFraction, truncate, round, ceiling, floor),
60     RealFloat(floatRadix, floatDigits, floatRange, decodeFloat,
61               encodeFloat, exponent, significand, scaleFloat, isNaN,
62               isInfinite, isDenormalized, isIEEE, isNegativeZero),
63     subtract, even, odd, gcd, lcm, (^), (^^), 
64     fromIntegral, fromRealFrac, atan2
65   ) where
66
67 import PrelBase
68 import PrelList
69 import PrelRead
70 import PrelNum
71 import PrelNumExtra
72 import PrelTup
73 import PrelMaybe
74 import PrelEither
75 import PrelBounded
76 import PrelConc
77 import Monad
78 import Maybe
79 import PrelErr   ( error )
80 import IO
81
82 -- These can't conveniently be defined in PrelBase because they use numbers,
83 -- or I/O, so here's a convenient place to do them.
84
85 strict      :: (a -> b) -> a -> b
86 strict f x  = x `seq` f x
87
88 -- It is expected that compilers will recognize this and insert error
89 -- messages which are more appropriate to the context in which undefined 
90 -- appears. 
91
92 undefined               :: a
93 undefined               =  error "Prelude.undefined"
94 \end{code}
95
96
97