[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / lib / glaExts / MainIO.lhs
1 This is the mainPrimIO that must be used for Haskell~1.2.
2
3 \begin{code}
4 module Main ( mainPrimIO ) where
5
6 import PreludeMainIO_help       -- for type of "Main.main"
7 import PreludeDialogueIO        ( requestToPrimIO )
8 import TyIO
9 import UTypes                   ( Bin )
10
11 mainPrimIO :: PrimIO ()
12 mainPrimIO s = case (requestToPrimIO main s) of
13                 ( (), s2@(S# _) ) -> ( (), s2 )
14 \end{code}
15
16 OLD COMMENT:
17
18 Nota Bene!  @mainIO@ is written as an explicit function, rather than
19 by saying: @mainIO = requestToIO main@ so that the code generator
20 recognises @mainIO@ as a {\em function} (hence HNF, hence not
21 updatable), rather than a zero-arity CAF (hence updatable).  If it is
22 updated, then we have a mega-space leak, because the entire action
23 (@requestToIO main@) is retained indefinitely.
24
25 (This doesn't waste work because @mainIO@ is only used once.)