summaryrefslogtreecommitdiff
path: root/ghc/lib/std/PrelMain.lhs
Commit message (Collapse)AuthorAgeFilesLines
* [project @ 2002-02-05 15:42:04 by simonpj]simonpj2002-02-051-22/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --------- Main.main --------- A bunch of related fixes concerning 'main' * Arrange that 'main' doesn't need to be defined in module Main; it can be imported. * The typechecker now injects a binding Main.$main = PrelTopHandler.runMain main So the runtime system now calls Main.$main, not PrelMain.main. With z-encoding, this look like Main_zdmain_closure * The function PrelTopHandler.runMain :: IO a -> IO () wraps the programmer's 'main' in an exception-cacthing wrapper. * PrelMain.hs and Main.hi-boot are both removed from lib/std, along with multiple lines of special case handling in lib/std/Makefile. This is a worthwhile cleanup. * Since we now pick up whatever 'main' is in scope, the ranamer gets in on the act (RnRnv.checkMain). There is a little more info to get from the renamer to the typechecker, so I've defined a new type Rename.RnResult (c.f. TcModule.TcResult) * With GHCi, it's now a warning, not an error, to omit the binding of main (RnEnv.checkMain) * It would be easy to add a flag "-main-is foo"; the place to use that information is in RnEnv.checkMain. ------- On the way I made a new type, type HscTypes.FixityEnv = NameEnv Fixity and used it in various places I'd tripped over
* [project @ 2001-05-21 14:07:31 by simonmar]simonmar2001-05-211-56/+3
| | | | | | Move topHandler and friends into a module on their own. They can't go in PrelMain, because PrelMain isn't included in HSstd.o (because PrelMain depends on Main, which doesn't exist yet...)
* [project @ 2001-05-18 16:54:04 by simonmar]simonmar2001-05-181-5/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I/O library rewrite ------------------- This commit replaces the old C/Haskell I/O implementation with a new Haskell-only one using the new FFI & hsc2hs. main points: - lots of code deleted: we're about 3000 lines of C lighter, but the amount of Haskell code is about the same. - performance is ok: some operations are faster, others are slower. There's still some tuning to do, though. - the new library is designed to handle read/write streams much better: a read/write stream gets a special kind of handle internally called a "DuplexHandle", which actually contains two separate handles, one for writing and one for reading. The upshot is that you can do simultaneous reading and writing to/from a socket or FIFO without any locking problems. The effect is similar to calling socketToHandle twice, except that finalization works properly (creating two separate Handles could lead to the socket being closed too early when one of the Handles is GC'd). - hConnectTo and withHandleFor are gone (no one responded to my mail on GHC users, but we can always bring 'em back if necessary). - I made a half-hearted attempt at keeping the system-specific code in one place: see PrelPosix.hsc. - I've rearranged the I/O tests and added lots more. ghc/tests/lib/IO now contains Haskell 98-only IO tests, ghc/test/lib/{IOExts, Directory, Time} now contain tests for the relevant libraries. I haven't quite finished in here yet, the IO tests work but the others don't yet. - I haven't done anything about Unicode yet, but now we can start to discuss what needs doing here. The new library is using MutableByteArrays for its buffers because that turned out to be a *lot* easier (and quicker) than malloc'd buffers - I hope this won't cause trouble for unicode translations though. WARNING: Windows users refrain from updating until we've had a chance to fix any issues that arise. Testing: the basic H98 stuff has been pretty thoroughly tested, but the new duplex handle stuff is still a little green.
* [project @ 2000-06-30 13:39:35 by simonmar]simonmar2000-06-301-1/+3
| | | | | | - fix copyrights - remove some unused imports - comment formatting fixes
* [project @ 1999-05-18 14:59:04 by simonpj]simonpj1999-05-181-1/+0
| | | | ../compiler/msg_prel
* [project @ 1999-04-27 17:41:17 by sof]sof1999-04-271-44/+5
| | | | | | | | | | | | * Added toplevel exception handler: topHandler :: Bool -- bomb on exception caught -> Exception -> IO () for PrelMain.mainIO and Concurrent.forkIO to use * moved forkIO out of PrelConc and into Concurrent.
* [project @ 1999-03-17 13:19:19 by simonm]simonm1999-03-171-2/+18
| | | | | | | | | | | | | - Stack overflow now generates an (AsyncException StackOverflow) exception, which can be caught as normal. - Add a stack overflow handler to the top-level mainIO handler, with the standard behaviour (i.e. call the stack overflow hook and then exit). - Add a test for stack overflow catching. - Fix a couple of bugs in async exception support.
* [project @ 1999-02-04 11:54:08 by simonm]simonm1999-02-041-4/+1
| | | | | | Don't go into an infinite loop for errors generated by hPutStr when outputing an error message. Use writeErrString__ to output all errors (this won't generate a Haskell exception).
* [project @ 1998-12-02 13:17:09 by simonm]simonm1998-12-021-2/+32
| | | | Move 4.01 onto the main trunk.
* [project @ 1998-02-02 17:27:26 by simonm]simonm1998-02-021-0/+20
Library re-organisation: All libraries now live under ghc/lib, which has the following structure: ghc/lib/std -- all prelude files (libHS.a) ghc/lib/std/cbits ghc/lib/exts -- standard Hugs/GHC extensions (libHSexts.a) -- available with '-fglasgow-exts' ghc/lib/posix -- POSIX library (libHSposix.a) ghc/lib/posix/cbits -- available with '-syslib posix' ghc/lib/misc -- used to be hslibs/ghc (libHSmisc.a) ghc/lib/misc/cbits -- available with '-syslib misc' ghc/lib/concurrent -- Concurrent libraries (libHSconc.a) -- available with '-concurrent' Also, several non-standard prelude modules had their names changed to begin with 'Prel' to reduce namespace pollution. Addr ==> PrelAddr (Addr interface available in 'exts') ArrBase ==> PrelArr CCall ==> PrelCCall (CCall interface available in 'exts') ConcBase ==> PrelConc GHCerr ==> PrelErr Foreign ==> PrelForeign (Foreign interface available in 'exts') GHC ==> PrelGHC IOHandle ==> PrelHandle IOBase ==> PrelIOBase GHCmain ==> PrelMain STBase ==> PrelST Unsafe ==> PrelUnsafe UnsafeST ==> PrelUnsafeST