summaryrefslogtreecommitdiff
path: root/ghc/compiler/rename
Commit message (Collapse)AuthorAgeFilesLines
...
* [project @ 2002-08-29 15:44:11 by simonmar]simonmar2002-08-292-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Housekeeping: - The main goal is to remove dependencies on hslibs for a bootstrapped compiler, leaving only a requirement that the packages base, haskell98 and readline are built in stage 1 in order to bootstrap. We're almost there: Posix is still required for signal handling, but all other dependencies on hslibs are now gone. Uses of Addr and ByteArray/MutableByteArray array are all gone from the compiler. PrimPacked defines the Ptr type for GHC 4.08 (which didn't have it), and it defines simple BA and MBA types to replace uses of ByteArray and MutableByteArray respectively. - Clean up import lists. HsVersions.h now defines macros for some modules which have moved between GHC versions. eg. one now imports 'GLAEXTS' to get at unboxed types and primops in the compiler. Many import lists have been sorted as per the recommendations in the new style guidelines in the commentary. I've built the compiler with GHC 4.08.2, 5.00.2, 5.02.3, 5.04 and itself, and everything still works here. Doubtless I've got something wrong, though.
* [project @ 2002-07-29 12:22:37 by simonpj]simonpj2002-07-292-29/+34
| | | | | | | | | | | | | | | *** MERGE TO STABLE BRANCH *** Surprisingly large delta to make rebindable names work properly. I was sloppily not checking the type of the user-supplied name, and Ashley Yakeley's first experiment showed up the problem! Solution: typechecker has to check both the 'standard' name and the 'user' name and check the latter has a type compatible with the former. The main comment is with Inst.tcSyntaxName (a new function).
* [project @ 2002-06-27 15:38:56 by simonmar]simonmar2002-06-271-3/+3
| | | | | | | | | | | | | | | | | | | | | Finally fix foreign export and foreign import "wrapper" so that exceptions raised during the call are handled properly rather than causing the RTS to bomb out. In particular, calling System.exitWith in a foreign export will cause the program to terminate cleanly with the desired exit code. All other exceptions are printed on stderr (and the program is terminated). Details: GHC.TopHandler.runMain is now called runIO, and has type IO a -> IO a (previously it had type IO a -> IO (), but that's not general enough for a foreign export). The stubs for foreign export and forein import "wrapper" now automatically wrap the computation in runIO or its dual, runNonIO. It turned out to be simpler to do it this way than to do the wrapping in Haskell land (plain foreign exports don't have wrappers in Haskell).
* [project @ 2002-06-17 11:24:30 by simonpj]simonpj2002-06-171-1/+2
| | | | Record correct location for fixity errors
* [project @ 2002-06-07 07:16:04 by chak]chak2002-06-072-0/+4
| | | | | | | | | | | Fixed handling of infix operators in types: - Pretty printing didn't take nested infix operators into account - Explicit parenthesis were ignored in the fixity parser: * I added a constructor `HsParTy' to `HsType' (in the spirit of `HsPar' in `HsExpr'), which tracks the use of explicit parenthesis * Occurences of `HsParTy' in type-ish things that are not quite types (like context predicates) are removed in `ParseUtils'; all other occurences of `HsParTy' are removed during type checking (just as it works with `HsPar')
* [project @ 2002-06-06 07:48:47 by simonpj]simonpj2002-06-061-3/+3
| | | | Fix bogon in rebindable syntax implementation
* [project @ 2002-06-05 14:39:27 by simonpj]simonpj2002-06-052-24/+42
| | | | | | | | | | | | | | --------------------------------------- Add rebindable syntax for do-notation (this time, on the HEAD) --------------------------------------- Make do-notation use rebindable syntax, so that -fno-implicit-prelude makes do-notation use whatever (>>=), (>>), return, fail are in scope, rather than the Prelude versions. On the way, combine HsDo and HsDoOut into one constructor in HsSyn, and tidy up type checking of HsDo.
* [project @ 2002-05-28 08:38:19 by simonpj]simonpj2002-05-281-2/+1
| | | | Fix assert
* [project @ 2002-05-27 16:13:42 by simonpj]simonpj2002-05-271-3/+11
| | | | | | | | | | | | | | | | | Make negative literals work in patterns The issue here is that f (-1) = True f x = False should generate f x = x == negate (fromInteger 1) rather than f x = x == fromInteger (-1)
* [project @ 2002-05-27 15:28:07 by simonpj]simonpj2002-05-278-187/+270
| | | | | | | | | | | | | | | | | Allow infix type constructors This commit adds infix type constructors (but not yet class constructors). The documentation describes what should be the case. Lots of tiresome changes, but nothing exciting. Allows infix type constructors everwhere a type can occur, and in a data or type synonym decl. E.g. data a :*: b = .... You can give fixity decls for type constructors, but the fixity decl applies both to the tycon and the corresponding data con.
* [project @ 2002-05-15 08:59:58 by chak]chak2002-05-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added the options `-ffi' and `-fffi', which switch on FFI support (`-fglasgow-exts' implies `-fffi'). NB: Strictly speaking `-fffi' is the correct name; however, `-ffi' is supported as an alternative spelling. * `-fglasgow-exts' no longer enables the `with' keyword for implicit parameters. To use `with' as a keyword, the additional option `-fwith' has to be supplied. (Note that SimonM recently enabled the use of `let' instead of `with'.) NB: This might prompt some makefile tweaks in libraries or regression tests. * Renamed `Foreign.Marshal.Utils.withObject' to `Foreign.Marshal.Utils.with' as required by the FFI Addendum. (The old name is still available, but marked as deprecated.) * Added `realloc' to `Foreign.Marshal.Alloc' (tracking RC4 of the FFI Addendum). Docu ~~~~ * Added `-ffi', `-fffi', and `-fwith' to the flag reference and the section describing options for Glasgow extensions * Removed most of the FFI section in the User's Guide in favour of a reference to the Addendum plus a brief description of additional features supported by GHC. NB: The old material is still available at fptools/docs/, I merely removed the reference in the User's Guide.
* [project @ 2002-05-03 11:25:58 by simonmar]simonmar2002-05-031-2/+6
| | | | | | seqList the result of mkImportInfo: this fixes a space leak whereby the entire collection of Ifaces read by the renamer were being held on to during the core-to-core phases.
* [project @ 2002-05-03 11:10:47 by simonmar]simonmar2002-05-031-3/+1
| | | | Eliminate a duplicate binding
* [project @ 2002-04-29 14:03:38 by simonmar]simonmar2002-04-293-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | FastString cleanup, stage 1. The FastString type is no longer a mixture of hashed strings and literal strings, it contains hashed strings only with O(1) comparison (except for UnicodeStr, but that will also go away in due course). To create a literal instance of FastString, use FSLIT(".."). By far the most common use of the old literal version of FastString was in the pattern ptext SLIT("...") this combination still works, although it doesn't go via FastString any more. The next stage will be to remove the need to use this special combination at all, using a RULE. To convert a FastString into an SDoc, now use 'ftext' instead of 'ptext'. I've also removed all the FAST_STRING related macros from HsVersions.h except for SLIT and FSLIT, just use the relevant functions from FastString instead.
* [project @ 2002-04-24 10:12:52 by simonpj]simonpj2002-04-242-10/+20
| | | | Do the scoped-tyvar fix right this time
* [project @ 2002-04-23 08:55:47 by simonpj]simonpj2002-04-231-1/+14
| | | | Reject attempts to rebind built in syntax
* [project @ 2002-04-23 08:52:16 by simonpj]simonpj2002-04-231-1/+8
| | | | Without -fglasow-exts, quantify over all mentioned type vars in type sigs
* [project @ 2002-04-23 08:40:52 by simonmar]simonmar2002-04-231-2/+3
| | | | Need to pull in thenIO when compiling a stmt now.
* [project @ 2002-04-11 12:03:29 by simonpj]simonpj2002-04-113-54/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------- Mainly derived Read ------------------- This commit is a tangle of several things that somehow got wound up together, I'm afraid. The main course ~~~~~~~~~~~~~~~ Replace the derived-Read machinery with Koen's cunning new parser combinator library. The result should be * much smaller code sizes from derived Read * faster execution of derived Read WARNING: I have not thoroughly tested this stuff; I'd be glad if you did! All the hard work is done, but there may be a few nits. The Read class gets two new methods, not exposed in the H98 inteface of course: class Read a where readsPrec :: Int -> ReadS a readList :: ReadS [a] readPrec :: ReadPrec a -- NEW readListPrec :: ReadPrec [a] -- NEW There are the following new libraries: Text.ParserCombinators.ReadP Koens combinator parser Text.ParserCombinators.ReadPrec Ditto, but with precedences Text.Read.Lex An emasculated lexical analyser that provides the functionality of H98 'lex' TcGenDeriv is changed to generate code that uses the new libraries. The built-in instances of Read (List, Maybe, tuples, etc) use the new libraries. Other stuff ~~~~~~~~~~~ 1. Some fixes the the plumbing of external-core generation. Sigbjorn did most of the work earlier, but this commit completes the renaming and typechecking plumbing. 2. Runtime error-generation functions, such as GHC.Err.recSelErr, GHC.Err.recUpdErr, etc, now take an Addr#, pointing to a UTF8-encoded C string, instead of a Haskell string. This makes the *calls* to these functions easier to generate, and smaller too, which is a good thing. In particular, it means that MkId.mkRecordSelectorId doesn't need to be passed "unpackCStringId", which was GRUESOME; and that in turn means that tcTypeAndClassDecls doesn't need to be passed unf_env, which is a very worthwhile cleanup. Win/win situation. 3. GHC now faithfully translates do-notation using ">>" for statements with no binding, just as the report says. While I was there I tidied up HsDo to take a list of Ids instead of 3 (but now 4) separate Ids. Saves a bit of code here and there. Also introduced Inst.newMethodFromName to package a common idiom.
* [project @ 2002-04-08 19:28:39 by sof]sof2002-04-081-0/+7
| | | | renameExtCore: bring locally defined names into scope before closing up
* [project @ 2002-04-05 23:24:25 by sof]sof2002-04-051-2/+2
| | | | Friday afternoon pet peeve removal: define (Util.notNull :: [a] -> Bool) and use it
* [project @ 2002-04-05 15:18:25 by sof]sof2002-04-052-9/+68
| | | | | | | | | | | Cleaned up the way the External Core front-end was integrated with the rest of the compiler; guided by detailed and helpful feedback from Simon PJ. Input files ending in ".hcr" are now assumed to contain external core -- still working on getting the renamer to slurp in interface files (implicitly) referred to in the Core source.
* [project @ 2002-04-02 13:56:32 by simonmar]simonmar2002-04-021-3/+10
| | | | | | | | Allow the use of 'let' for implcit bindings. Support for 'with' is left in place for the time being, but on seeing a 'with' we emit a non-suppressible warning about 'with' being deprecated in favour of 'let'.
* [project @ 2002-04-01 09:24:29 by simonpj]simonpj2002-04-011-0/+7
| | | | Comments
* [project @ 2002-04-01 08:23:30 by simonpj]simonpj2002-04-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------ Change the treatment of the stupid context on data constructors ----------------------------------- Data types can have a context: data (Eq a, Ord b) => T a b = T1 a b | T2 a and that makes the constructors have a context too (notice that T2's context is "thinned"): T1 :: (Eq a, Ord b) => a -> b -> T a b T2 :: (Eq a) => a -> T a b Furthermore, this context pops up when pattern matching (though GHC hasn't implemented this, but it is in H98, and I've fixed GHC so that it now does): f (T2 x) = x gets inferred type f :: Eq a => T a b -> a I say the context is "stupid" because the dictionaries passed are immediately discarded -- they do nothing and have no benefit. It's a flaw in the language. Up to now I have put this stupid context into the type of the "wrapper" constructors functions, T1 and T2, but that turned out to be jolly inconvenient for generics, and record update, and other functions that build values of type T (because they don't have suitable dictionaries available). So now I've taken the stupid context out. I simply deal with it separately in the type checker on occurrences of a constructor, either in an expression or in a pattern. To this end * Lots of changes in DataCon, MkId * New function Inst.tcInstDataCon to instantiate a data constructor I also took the opportunity to * Rename dataConId --> dataConWorkId for consistency. * Tidied up MkId.rebuildConArgs quite a bit, and renamed it mkReboxingAlt * Add function DataCon.dataConExistentialTyVars, with the obvious meaning
* [project @ 2002-03-29 21:39:36 by sof]sof2002-03-294-0/+17
| | | | | | | | | Front end for External Core. Initial go at implementing a Core front end (enabled via -fcore); work in progress (renamer is currently not willing to slurp in & resolve imports.)
* [project @ 2002-03-28 17:52:08 by simonmar]simonmar2002-03-281-1/+1
| | | | | | | | | | | | | | In lookupTopBndrRn, if we're in an interface file, then create the binder in the cache with the correct Module (inc. package name) rather than making a vanilla module as we do currently. This helps to get the package names right in names from interfaces that we've read via checkOldIface (ie. "skipped" modules), and fixes a bug to do with unnecessary version bumping and recompilation. (Simon P.J. will add a better comment later) MERGE TO STABLE
* [project @ 2002-03-14 16:22:31 by simonmar]simonmar2002-03-141-1/+1
| | | | | Misc cleanup: remove the iface pretty-printing style, and clean up bits of StringBuffer that aren't required any more.
* [project @ 2002-03-14 15:47:52 by simonmar]simonmar2002-03-145-900/+17
| | | | | | | | | | | | | | | | | | | | | Remove the interface file parser, and move .hi-boot parsing into the main parser. The syntax of .hi-boot files is now greatly improved in terms of readability; here's an example: module M where data T f :: T -> GHC.Base.Int note that (a) layout can be used (b) there's no explcit export list; everything declared is implicitly exported (c) Z-encoding of names is no longer required (d) Any identifier not declared in the current module must still be quailified with the module which originally defined it (eg. GHC.Base.Int above). We'd like to relax (d), but that will come later.
* [project @ 2002-03-14 15:27:15 by simonpj]simonpj2002-03-146-15/+15
| | | | | | | | | | | | | | | | | | | ------------------------ Change GlobalName --> ExternalName LocalName -> InternalName ------------------------ For a long time there's been terminological confusion between GlobalName vs LocalName (property of a Name) GlobalId vs LocalId (property of an Id) I've now changed the terminology for Name to be ExternalName vs InternalName I've also added quite a bit of documentation in the Commentary.
* [project @ 2002-03-08 16:00:39 by simonmar]simonmar2002-03-081-2/+8
| | | | Make this compile with various GHC versions (hopefully)
* [project @ 2002-03-06 14:47:17 by simonmar]simonmar2002-03-061-5/+9
| | | | Include the fixity declaration for 'seq' in the GHC.Prim interface.
* [project @ 2002-03-05 14:18:53 by simonmar]simonmar2002-03-052-13/+42
| | | | | | | | | | | | | Generate the contents of the GHC.Prim interface file automatically from the list of available PrimOps and various other wired-in things. Two main benefits from this: - There's one fewer places to edit when adding a new primop. - It's one less reason to need the interface file parser, and now we no longer need the (short-lived) --compile-iface option so I've removed it.
* [project @ 2002-03-04 17:01:26 by simonmar]simonmar2002-03-044-46/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Binary Interface Files - stage 1 -------------------------------- This commit changes the default interface file format from text to binary, in order to improve compilation performace. To view an interface file, use 'ghc --show-iface Foo.hi'. utils/Binary.hs is the basic Binary I/O library, based on the nhc98 binary I/O library but much stripped-down and working in terms of bytes rather than bits, and with some special features for GHC: it remembers which Module is being emitted to avoid dumping too many qualified names, and it keeps track of a "dictionary" of FastStrings so that we don't dump the same FastString more than once into the binary file. I'll make a generic version of this for the libraries at some point. main/BinIface.hs contains most of the Binary instances. Some instances are in the same module as the data type (RdrName, Name, OccName in particular). Most instances were generated using a modified version of DrIFT, which I'll commit later. However, editing them by hand isn't hard (certainly easier than modifying ParseIface.y). The first thing in a binary interface is the interface version, so nice error messages will be generated if the binary format changes and you still have old interfaces lying around. The version also now includes the "way" as an extra sanity check. Other changes ------------- I don't like the way FastStrings contain both hashed strings (with O(1) comparison) and literal C strings (with O(n) comparison). So as a first step to separating these I made serveral "literal" type strings into hashed strings. SLIT() still generates a literal, and now FSLIT() generates a hashed string. With DEBUG on, you'll get a warning if you try to compare any SLIT()s with anything, and the compiler will fall over if you try to dump any literal C strings into an interface file (usually indicating a use of SLIT() which should be FSLIT()). mkSysLocal no longer re-encodes its FastString argument each time it is called. I also fixed the -pgm options so that the argument can now optionally be separted from the option. Bugfix: PrelNames declared Names for several comparison primops, eg. eqCharName, eqIntName etc. but these had different uniques from the real primop names. I've moved these to PrimOps and defined them using mkPrimOpIdName instead, and deleted some for which we don't have real primops (Manuel: please check that things still work for you after this change).
* [project @ 2002-02-14 13:59:22 by simonpj]simonpj2002-02-141-1/+1
| | | | Import wibbles
* [project @ 2002-02-13 15:19:17 by simonpj]simonpj2002-02-134-27/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ---------------------------------- Do the Right Thing for TyCons where we can't see all their constructors. ---------------------------------- Inside a TyCon, three things can happen 1. GHC knows all the constructors, and has them to hand. (Nowadays, there may be zero constructors.) 2. GHC knows all the constructors, but has declined to slurp them all in, to avoid sucking in more declarations than necessary. All we remember is the number of constructors, so we can get the return convention right. 3. GHC doesn't know anything. This happens *only* for decls coming from .hi-boot files, where the programmer declines to supply a representation. Until now, these three cases have been conflated together. Matters are worse now that a TyCon really can have zero constructors. In fact, by confusing (3) with (1) we can actually generate bogus code. With this commit, the dataCons field of a TyCon is of type: data DataConDetails datacon = DataCons [datacon] -- Its data constructors, with fully polymorphic types -- A type can have zero constructors | Unknown -- We're importing this data type from an hi-boot file -- and we don't know what its constructors are | HasCons Int -- In a quest for compilation speed we have imported -- only the number of constructors (to get return -- conventions right) but not the constructors themselves This says exactly what is going on. There are lots of consequential small changes.
* [project @ 2002-02-13 14:52:43 by simonmar]simonmar2002-02-131-8/+11
| | | | | Catch up with Haskell 98 revisions: allow sections like (++ x ++ y) and (3 + 4 +).
* [project @ 2002-02-12 15:17:13 by simonmar]simonmar2002-02-122-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch over to the new hierarchical libraries --------------------------------------------- This commit reorganises our libraries to use the new hierarchical module namespace extension. The basic story is this: - fptools/libraries contains the new hierarchical libraries. Everything in here is "clean", i.e. most deprecated stuff has been removed. - fptools/libraries/base is the new base package (replacing "std") and contains roughly what was previously in std, lang, and concurrent, minus deprecated stuff. Things that are *not allowed* in libraries/base include: Addr, ForeignObj, ByteArray, MutableByteArray, _casm_, _ccall_, ``'', PrimIO For ByteArrays and MutableByteArrays we use UArray and STUArray/IOUArray respectively now. Modules previously called PrelFoo are now under fptools/libraries/GHC. eg. PrelBase is now GHC.Base. - fptools/libraries/haskell98 provides the Haskell 98 std. libraries (Char, IO, Numeric etc.) as a package. This package is enabled by default. - fptools/libraries/network is a rearranged version of the existing net package (the old package net is still available; see below). - Other packages will migrate to fptools/libraries in due course. NB. you need to checkout fptools/libraries as well as fptools/hslibs now. The nightly build scripts will need to be tweaked. - fptools/hslibs still contains (almost) the same stuff as before. Where libraries have moved into the new hierarchy, the hslibs version contains a "stub" that just re-exports the new version. The idea is that code will gradually migrate from fptools/hslibs into fptools/libraries as it gets cleaned up, and in a version or two we can remove the old packages altogether. - I've taken the opportunity to make some changes to the build system, ripping out the old hslibs Makefile stuff from mk/target.mk; the new package building Makefile code is in mk/package.mk (auto-included from mk/target.mk). The main improvement is that packages now register themselves at make boot time using ghc-pkg, and the monolithic package.conf in ghc/driver is gone. I've updated the standard packages but haven't tested win32, graphics, xlib, object-io, or OpenGL yet. The Makefiles in these packages may need some further tweaks, and they'll need pkg.conf.in files added. - Unfortunately all this rearrangement meant I had to bump the interface-file version and create a bunch of .hi-boot-6 files :-(
* [project @ 2002-02-11 15:16:25 by simonpj]simonpj2002-02-113-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | ---------------------------------- Implement kinded type declarations ---------------------------------- This commit allows the programmer to supply kinds in * data decls * type decls * class decls * 'forall's in types e.g. data T (x :: *->*) = MkT type Composer c = forall (x :: * -> *) (y :: * -> *) (z :: * -> *). (c y z) -> (c x y) -> (c x z); This is occasionally useful. It turned out to be convenient to add the form (type :: kind) to the syntax of types too, so you can put kind signatures in types as well.
* [project @ 2002-02-11 09:21:52 by simonpj]simonpj2002-02-111-38/+10
| | | | Remove unused rules
* [project @ 2002-02-11 08:20:38 by chak]chak2002-02-116-26/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ******************************* * Merging from ghc-ndp-branch * ******************************* This commit merges the current state of the "parallel array extension" and includes the following: * (Almost) completed Milestone 1: - The option `-fparr' activates the H98 extension for parallel arrays. - These changes have a high likelihood of conflicting (in the CVS sense) with other changes to GHC and are the reason for merging now. - ToDo: There are still some (less often used) functions not implemented in `PrelPArr' and a mechanism is needed to automatically import `PrelPArr' iff `-fparr' is given. Documentation that should go into the Commentary is currently in `ghc/compiler/ndpFlatten/TODO'. * Partial Milestone 2: - The option `-fflatten' activates the flattening transformation and `-ndp' selects the "ndp" way (where all libraries have to be compiled with flattening). The way option `-ndp' automagically turns on `-fparr' and `-fflatten'. - Almost all changes are in the new directory `ndpFlatten' and shouldn't affect the rest of the compiler. The only exception are the options and the points in `HscMain' where the flattening phase is called when `-fflatten' is given. - This isn't usable yet, but already implements function lifting, vectorisation, and a new analysis that determines which parts of a module have to undergo the flattening transformation. Missing are data structure and function specialisation, the unboxed array library (including fusion rules), and lots of testing. I have just run the regression tests on the thing without any problems. So, it seems, as if we haven't broken anything crucial.
* [project @ 2002-02-07 12:51:47 by simonpj]simonpj2002-02-071-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -------------------------------------------------- Slurp in a few more instance decls with ghc --make -------------------------------------------------- ghc --make wasn't slurping in quite enough instance decls. The relevant comment is in RnIfaces; the new part is marked. George Russel's Uniform showed this up. We slurp in an instance decl from the gated instance pool iff all its gates are either in the gates of the module, or are a previously-loaded tycon or class. The latter constraint is because there might have been an instance decl slurped in during an earlier compilation, like this: instance Foo a => Baz (Maybe a) where ... In the module being compiled we might need (Baz (Maybe T)), where T is defined in this module, and hence we need (Foo T). So @Foo@ becomes a gate. But there's no way to 'see' that. NEW: More generally, types might be involved as well: NEW: instance Foo2 T a => Baz2 a where ... NEW: NEW: Now we must treat T as a gate too, as well as Foo. So the solution NEW: we adopt is: NEW: NEW: we simply treat all previously-loaded NEW: tycons and classes as gates. NEW: NEW: This gloss only affects ghc --make and ghc --interactive.
* [project @ 2002-02-06 15:54:23 by simonpj]simonpj2002-02-061-2/+0
| | | | | | | | | Eliminate all vestiages of UsageTy, in preparation for Keith's new version. Hurrah! Keith: LBVarInfo and usOnce,usMany are still there, because I know you have eliminated LBVarInfo, and I didn't want to cause unnecessary conflicts.
* [project @ 2002-02-06 12:12:25 by keithw]keithw2002-02-062-4/+12
| | | | | | | | | | | | | Merging the following onto the HEAD: | 1.61.2.1 +2 -4 fptools/ghc/compiler/rename/RnHsSyn.lhs | 1.135.2.1 +10 -0 fptools/ghc/compiler/rename/RnSource.lhs Original comment (keithw): Remove derivings FVs from tyClDeclFVs, because they aren't needed by interface files. Instead, we return these FVs from finishSourceTyClDecl.
* [project @ 2002-02-05 15:42:04 by simonpj]simonpj2002-02-056-59/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --------- 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 @ 2002-02-05 15:02:23 by simonpj]simonpj2002-02-053-3/+3
| | | | Imports only
* [project @ 2002-02-04 03:40:31 by chak]chak2002-02-042-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Foreign import/export declarations now conform to FFI Addendum Version 1.0 * The old form of foreign declarations is still supported, but generates deprecation warnings. * There are some rather exotic old-style declarations which have become invalid as they are interpreted differently under the new scheme and there is no (easy) way to determine which style the programmer had in mind (eg, importing a C function with the name `wrapper' where the external name is explicitly given will not work in some situations - depends on whether an `unsafe' was specified and similar things). * Some "new" old-style forms have been introduced to make parsing a little bit easier (ie, avoid shift/reduce conflicts between new-style and old-style grammar rules), but they are few, arcane, and don't really hurt (and I won't tell what they are, you need to find that out by yourself ;-) * The FFI Addendum doesn't specify whether a header file that is requested for inclusion by multiple foreign declarations should be included only once or multiple times. GHC at the moment includes an header as often as it appears in a foreign declaration. For properly written headers, it doesn't make a difference anyway... * Library object specifications are currently silently ignored. The feature was mainly requested for external calls in .NET (ie, calls which invoke C routines when Haskell is compiled to ILX), but those don't seem to be supported yet. * Foreign label declarations are currently broken, but they were already broken before I started messing with the stuff. The code is moderately tested. All modules in lib/std/ and hslibs/lang/ (using old-style declarations) still compile fine and I have run a couple of tests on the different forms of new-style declarations.
* [project @ 2002-01-30 16:37:14 by simonmar]simonmar2002-01-304-36/+38
| | | | | | | | | | | | | | | | | | | | | | | | Simplify the package story inside the compiler. The new story is this: The Finder no longer determines a module's package based on its filesystem location. The filesystem location indicates only whether a given module is in the current package or not (i.e. found along the -i path ==> current package, found along the package path ==> other package). Hence a Module no longer contains a package name. Instead it just contains PackageInfo, which is either ThisPackage or AnotherPackage. The compiler uses this information for generating cross-DLL calls and omitting certain version information from .hi files. The interface still contains the package name. This isn't used for anything right now, but in the future (when we have hierarchical libraries) we might use it to automatically determine which packages a binary should be linked against. When building a package, you should still use -package-name, but it won't be fatal if you don't. The warning/error about package name mismatches has gone away.
* [project @ 2002-01-29 09:58:14 by simonpj]simonpj2002-01-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------ Rule phasing ------------ This commit adds a little more control to when rules are enabled. {-# RULES "foo" [2] forall ... "baz" [~2] forall ... #-} Rule "foo" is active in phase 2 and later. The new thing is that the "~2" means that Rule "baz" is active in phase 3 and earlier. (Remember tha phases decrease towards zero.) All the machinery was there to implement this, it just needed the syntax. Why do this? Peter Gammie (at UNSW) found that rules weren't firing because of bindings of the form M.f = f f = .... where the rules where on the M.f binding. It turned out that an old hack (which have for some time elicited the harmless "shortMeOut" debug warnings) prevented this trivial construction from being correctly simplified. The hack in turn derived from a trick in the way the foldr/build rule was implemented....and that hack is no longer necessary now we can switch rules *off* as well as *on*. There are consequential changes in the Prelude foldr/build RULE stuff. It's a clean-up.... Instead of strange definitions like map = mapList which we had before, we have an ordinary recursive defn of map, together with rules to convert first to foldr/build form, and then (if nothing happens) back again. There's a fairly long comment about the general plan of attack in PrelBase, near the defn of map.
* [project @ 2002-01-24 16:55:35 by simonmar]simonmar2002-01-241-1/+26
| | | | | | | | | | | | | | | | | Add support for Hugs's :browse (or :b) command. There are two forms: - :b M (interpreted modules only) shows everything defined in M - the types of top-level functions, and definitions of classes and datatypes. - :b *M shows everything exported from module M. Available for both compiled and interpreted modules. The user interface is subject to change, but for now it is consistent with the new semantics of the :module command. The implementation is a little tricky, since for a package module we have to be sure to slurp in all the required declarations first.