+% ------------------------------------------------------------------------------
+% $Id: Prelude.lhs,v 1.26 2001/05/18 16:54:05 simonmar Exp $
+%
+% (c) The University of Glasgow, 1992-2000
+%
+
+\section[Prelude]{Module @Prelude@}
+
We add the option -fno-implicit-prelude here to tell the reader that
special names such as () and -> shouldn't be resolved to Prelude.()
and Prelude.-> (as they are normally). -- SDM 8/10/97
showChar, showString, readParen, showParen,
-- Everything corresponding to the Report's PreludeIO
- FilePath, IOError,
ioError, userError, catch,
- putChar, putStr, putStrLn, print,
- getChar, getLine, getContents, interact,
+ FilePath, IOError,
+ putChar,
+ putStr, putStrLn, print,
+ getChar,
+ getLine, getContents, interact,
readFile, writeFile, appendFile, readIO, readLn,
Bool(..),
Ord(..),
Enum(..),
Bounded(..),
- Num((+), (-), (*), negate, abs, signum, fromInteger),
- -- The fromInt method is exposed only by GlaExts
+ Num(..),
Real(..),
- Integral(quot, rem, div, mod, quotRem, divMod, toInteger),
- -- The toInt method is exposed only by GlaExts
+ Integral(..),
Fractional(..),
Floating(..),
RealFrac(..),
RealFloat(..),
- -- From Monad
+ -- Monad stuff, from PrelBase, and defined here
Monad(..),
Functor(..),
mapM, mapM_, sequence, sequence_, (=<<),
) where
+import Monad
+
import PrelBase
import PrelList
#ifndef USE_REPORT_PRELUDE
hiding ( takeUInt_append )
#endif
+import PrelIO
+import PrelIOBase
+import PrelException
import PrelRead
import PrelEnum
import PrelNum
import PrelMaybe
import PrelShow
import PrelConc
-import Monad
-import Maybe
-import PrelErr ( error )
-import IO
+import PrelErr ( error, undefined )
infixr 0 $!
+\end{code}
-($!) :: (a -> b) -> a -> b
-f $! x = x `seq` f x
--- It is expected that compilers will recognize this and insert error
--- messages which are more appropriate to the context in which undefined
--- appears.
+%*********************************************************
+%* *
+\subsection{Miscellaneous functions}
+%* *
+%*********************************************************
-undefined :: a
-undefined = error "Prelude.undefined"
+\begin{code}
+($!) :: (a -> b) -> a -> b
+f $! x = x `seq` f x
\end{code}
#endif
\end{code}
-
-%*********************************************************
-%* *
-\subsection{Coercions}
-%* *
-%*********************************************************
-
-\begin{code}
-{-# SPECIALIZE fromIntegral ::
- Int -> Rational,
- Integer -> Rational,
- Int -> Int,
- Int -> Integer,
- Int -> Float,
- Int -> Double,
- Integer -> Int,
- Integer -> Integer,
- Integer -> Float,
- Integer -> Double #-}
-fromIntegral :: (Integral a, Num b) => a -> b
-fromIntegral = fromInteger . toInteger
-
-{-# SPECIALIZE realToFrac ::
- Double -> Rational,
- Rational -> Double,
- Float -> Rational,
- Rational -> Float,
- Rational -> Rational,
- Double -> Double,
- Double -> Float,
- Float -> Float,
- Float -> Double #-}
-realToFrac :: (Real a, Fractional b) => a -> b
-realToFrac = fromRational . toRational
-\end{code}