- 13 Sep, 2002 1 commit
-
-
simonpj authored
-------------------------------------- Make Template Haskell into the HEAD -------------------------------------- This massive commit transfers to the HEAD all the stuff that Simon and Tim have been doing on Template Haskell. The meta-haskell-branch is no more! WARNING: make sure that you * Update your links if you are using link trees. Some modules have been added, some have gone away. * Do 'make clean' in all library trees. The interface file format has changed, and you can get strange panics (sadly) if GHC tries to read old interface files: e.g. ghc-5.05: panic! (the `impossible' happened, GHC version 5.05): Binary.get(TyClDecl): ForeignType * You need to recompile the rts too; Linker.c has changed However the libraries are almost unaltered; just a tiny change in Base, and to the exports in Prelude. NOTE: so far as TH itself is concerned, expression splices work fine, but declaration splices are not complete. --------------- The main change --------------- The main structural change: renaming and typechecking have to be interleaved, because we can't rename stuff after a declaration splice until after we've typechecked the stuff before (and the splice itself). * Combine the renamer and typecheker monads into one (TcRnMonad, TcRnTypes) These two replace TcMonad and RnMonad * Give them a single 'driver' (TcRnDriver). This driver replaces TcModule.lhs and Rename.lhs * The haskell-src library package has a module Language/Haskell/THSyntax which defines the Haskell data type seen by the TH programmer. * New modules: hsSyn/Convert.hs converts THSyntax -> HsSyn deSugar/DsMeta.hs converts HsSyn -> THSyntax * New module typecheck/TcSplice type-checks Template Haskell splices. ------------- Linking stuff ------------- * ByteCodeLink has been split into ByteCodeLink (which links) ByteCodeAsm (which assembles) * New module ghci/ObjLink is the object-code linker. * compMan/CmLink is removed entirely (was out of place) Ditto CmTypes (which was tiny) * Linker.c initialises the linker when it is first used (no need to call initLinker any more). Template Haskell makes it harder to know when and whether to initialise the linker. ------------------------------------- Gathering the LIE in the type checker ------------------------------------- * Instead of explicitly gathering constraints in the LIE tcExpr :: RenamedExpr -> TcM (TypecheckedExpr, LIE) we now dump the constraints into a mutable varabiable carried by the monad, so we get tcExpr :: RenamedExpr -> TcM TypecheckedExpr Much less clutter in the code, and more efficient too. (Originally suggested by Mark Shields.) ----------------- Remove "SysNames" ----------------- Because the renamer and the type checker were entirely separate, we had to carry some rather tiresome implicit binders (or "SysNames") along inside some of the HsDecl data structures. They were both tiresome and fragile. Now that the typechecker and renamer are more intimately coupled, we can eliminate SysNames (well, mostly... default methods still carry something similar). ------------- Clean up HsPat ------------- One big clean up is this: instead of having two HsPat types (InPat and OutPat), they are now combined into one. This is more consistent with the way that HsExpr etc is handled; there are some 'Out' constructors for the type checker output. So: HsPat.InPat --> HsPat.Pat HsPat.OutPat --> HsPat.Pat No 'pat' type parameter in HsExpr, HsBinds, etc Constructor patterns are nicer now: they use HsPat.HsConDetails for the three cases of constructor patterns: prefix, infix, and record-bindings The *same* data type HsConDetails is used in the type declaration of the data type (HsDecls.TyData) Lots of associated clean-up operations here and there. Less code. Everything is wonderful.
-
- 29 Jul, 2002 1 commit
-
-
simonmar authored
Type variables created by the typechecker didn't have the correct NameSpace: they were in the Var namespace rather than the TyVar namespace, which can lead to strange warnings about quantified type variables being not mentioned in the type when DEBUG is on. Name: - added mkSystemNameEncoded for use when the string is already encoded (saves re-encoding the string every time) - added mkSystemTvNameEncoded for making a type variable name, as above Var: - use mkSystemTvNameEncoded when making type variables Id: - add mkSysLocalUnencoded for the (rare) case when the string needs encoding TcMType: - use mkSystemTvNameEncoded rather than mkSystemName for making type variables SetLevels: - use mkSysLocalUnencoded since the names generated here need encoding.
-
- 27 May, 2002 1 commit
-
-
simonmar authored
Use Unique.getKey instead of Unique.u2i (they are the same function).
-
- 15 Mar, 2002 1 commit
-
-
simonpj authored
Import wibbles
-
- 14 Mar, 2002 2 commits
-
-
simonmar authored
Misc cleanup: remove the iface pretty-printing style, and clean up bits of StringBuffer that aren't required any more.
-
simonpj authored
------------------------ 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.
-
- 04 Mar, 2002 1 commit
-
-
simonmar authored
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).
-
- 10 Dec, 2001 1 commit
-
-
simonmar authored
Make the OccName and SrcLoc fields of a Name strict, to eliminate space leaks. This doesn't hurt performance.
-
- 19 Oct, 2001 1 commit
-
-
simonpj authored
Fix codegen globalisation for -split-objs
-
- 22 May, 2001 1 commit
-
-
simonpj authored
------------------------------------------- Towards generalising 'foreign' declarations ------------------------------------------- This is a first step towards generalising 'foreign' declarations to handle langauges other than C. Quite a lot of files are touched, but nothing has really changed. Everything should work exactly as before. But please be on your guard for ccall-related bugs. Main things Basic data types: ForeignCall.lhs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Remove absCSyn/CallConv.lhs * Add prelude/ForeignCall.lhs. This defines the ForeignCall type and its variants * Define ForeignCall.Safety to say whether a call is unsafe or not (was just a boolean). Lots of consequential chuffing. * Remove all CCall stuff from PrimOp, and put it in ForeignCall Take CCallOp out of the PrimOp type (where it was always a glitch) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Add IdInfo.FCallId variant to the type IdInfo.GlobalIdDetails, along with predicates Id.isFCallId, Id.isFCallId_maybe * Add StgSyn.StgOp, to sum PrimOp with FCallOp, because it *is* useful to sum them together in Stg and AbsC land. If nothing else, it minimises changes. Also generally rename "CCall" stuff to "FCall" where it's generic to all foreign calls.
-
- 08 Mar, 2001 1 commit
-
-
simonpj authored
-------------------- A major hygiene pass -------------------- 1. The main change here is to Move what was the "IdFlavour" out of IdInfo, and into the varDetails field of a Var It was a mess before, because the flavour was a permanent attribute of an Id, whereas the rest of the IdInfo was ephemeral. It's all much tidier now. Main places to look: Var.lhs Defn of VarDetails IdInfo.lhs Defn of GlobalIdDetails The main remaining infelicity is that SpecPragmaIds are right down in Var.lhs, which seems unduly built-in for such an ephemeral thing. But that is no worse than before. 2. Tidy up the HscMain story a little. Move mkModDetails from MkIface into CoreTidy (where it belongs more nicely) This was partly forced by (1) above, because I didn't want to make DictFun Ids into a separate kind of Id (which is how it was before). Not having them separate means we have to keep a list of them right through, rather than pull them out of the bindings at the end. 3. Add NameEnv as a separate module (to join NameSet). 4. Remove unnecessary {-# SOURCE #-} imports from FieldLabel.
-
- 05 Mar, 2001 1 commit
-
-
simonpj authored
Print debug uniques consistently in base64
-
- 26 Feb, 2001 1 commit
-
-
simonmar authored
Implement do-style bindings on the GHCi command line. The syntax for a command-line is exactly that of a do statement, with the following meanings: - `pat <- expr' performs expr, and binds each of the variables in pat. - `let pat = expr; ...' binds each of the variables in pat, doesn't do any evaluation - `expr' behaves as `it <- expr' if expr is IO-typed, or `let it = expr' followed by `print it' otherwise.
-
- 07 Dec, 2000 1 commit
-
-
simonpj authored
Workers get local names initially; nuke mkDerivedName
-
- 06 Dec, 2000 1 commit
-
-
simonmar authored
Re-engineer the transition from Core to STG syntax. Main changes in this commit: - a new pass, CoreSat, handles saturation of constructors and PrimOps, and puts the syntax into STG-like normal form (applications to atoms only, etc), modulo type applications and Notes. - CoreToStg is now done at the same time as StgVarInfo. Most of the contents of StgVarInfo.lhs have been copied into CoreToStg.lhs and some simplifications made. less major changes: - globalisation of names for the purposes of object splitting is now done by the C code generator (which is the Right Place in principle, but it was a bit fiddly). - CoreTidy now does cloning of local binders and collection of arity info. The IdInfo from CoreTidy is now *almost* the final IdInfo we put in the interface file, except for CafInfo. I'm going to move the CafInfo collection into CoreTidy in due course too. - and some other minor tidyups while I was in cluster-bomb commit mode.
-
- 27 Nov, 2000 1 commit
-
-
simonpj authored
Dont print uniques in interface files; tidying should have sorted it out
-
- 24 Nov, 2000 2 commits
-
-
simonpj authored
1. Make the new version machinery work. I think it does now! 2. Consequence of (1): Move the generation of default method names to one place (namely in RdrHsSyn.mkClassOpSigDM 3. Major clean up on HsDecls.TyClDecl These big constructors should have been records ages ago, and they are now. At last.
-
simonpj authored
Version management [WARNING: may not work! Don't update till I've tested it.] This commit is a first stab at getting version management to work properly. The main trick is to get consistent naming when comparing old and new versions of the same module. Some functionality has moved arond between coreSyn/CoreTidy, which tidies up the result of the middle end of the compiler Main change: now responsible for figuring out which Ids are "external" (i.e visible to importing modules), and constructing the final IdInfo for each Id main/MkIface, which produces the ModIface and ModDetails for the module being compiled Main change: CoreTidy does more, so MkIface does less stgSyn/CoreToStg, which converts Core to STG Main change: responsible for globalising internal names when we are doing object code splitting The game plan is documented at the top of CoreTidy.
-
- 20 Nov, 2000 1 commit
-
-
sewardj authored
Split HscResult into HscFail | HscNoRecomp | HscRecomp, and clean up producers and consumers of such. In particular, if no recompilation happens, the resulting iface is put into the HIT instead of being thrown away. Also (trivial) unify functions *ModuleInThisPackage with *HomeModule.
-
- 14 Nov, 2000 2 commits
- 10 Nov, 2000 1 commit
-
-
simonpj authored
1. Outputable.PprStyle now carries a bit more information In particular, the printing style tells whether to print a name in unqualified form. This used to be embedded in a Name, but since Names now outlive a single compilation unit, that's no longer appropriate. So now the print-unqualified predicate is passed in the printing style, not embedded in the Name. 2. I tidied up HscMain a little. Many of the showPass messages have migraged into the repective pass drivers
-
- 01 Nov, 2000 1 commit
-
-
simonpj authored
More renamer commits Versioning now works properly I think. The main irritation is that interface files now have fuly-qualified names for *everything*, even things defined in that module. This is a deficiency in the pretty printing for interface files. Probable solution: add something to the SDoc styles. But not today.
-
- 31 Oct, 2000 3 commits
- 30 Oct, 2000 2 commits
- 27 Oct, 2000 1 commit
-
-
simonpj authored
Wibble
-
- 25 Oct, 2000 1 commit
-
-
simonpj authored
Tons of stuff for the mornings work
-
- 17 Oct, 2000 1 commit
-
-
sewardj authored
Fix enough renamer bits to get going again on the typechecker. HACK ALERT: RnIfaces is almost completely #ifdef'd out!
-
- 16 Oct, 2000 4 commits
- 12 Oct, 2000 3 commits
-
-
simonmar authored
Remove wired-in names. Partially propogated.
-
simonmar authored
Move FAST_INT and FAST_BOOL into their own module FastTypes, replacing the macro definitions in HsVersions.h with real definitions. Change most of the names in the process. Now we don't get bogus imports of GlaExts all over the place, and -fwarn-unused-imports is less noisy.
-
sewardj authored
Rename a bunch of mkSrc* things into mk*'s.
-
- 03 Oct, 2000 1 commit
-
-
simonpj authored
-------------------------------------- Adding generics SLPJ Oct 2000 -------------------------------------- This big commit adds Hinze/PJ-style generic class definitions, based on work by Andrei Serjantov. For example: class Bin a where toBin :: a -> [Int] fromBin :: [Int] -> (a, [Int]) toBin {| Unit |} Unit = [] toBin {| a :+: b |} (Inl x) = 0 : toBin x toBin {| a :+: b |} (Inr y) = 1 : toBin y toBin {| a :*: b |} (x :*: y) = toBin x ++ toBin y fromBin {| Unit |} bs = (Unit, bs) fromBin {| a :+: b |} (0:bs) = (Inl x, bs') where (x,bs') = fromBin bs fromBin {| a :+: b |} (1:bs) = (Inr y, bs') where (y,bs') = fromBin bs fromBin {| a :*: b |} bs = (x :*: y, bs'') where (x,bs' ) = fromBin bs (y,bs'') = fromBin bs' Now we can say simply instance Bin a => Bin [a] and the compiler will derive the appropriate code automatically. (About 9k lines of diffs. Ha!) Generic related things ~~~~~~~~~~~~~~~~~~~~~~ * basicTypes/BasicTypes: The EP type (embedding-projection pairs) * types/TyCon: An extra field in an algebraic tycon (genInfo) * types/Class, and hsSyn/HsBinds: Each class op (or ClassOpSig) carries information about whether it a) has no default method b) has a polymorphic default method c) has a generic default method There's a new data type for this: Class.DefMeth * types/Generics: A new module containing good chunk of the generic-related code It has a .hi-boot file (alas). * typecheck/TcInstDcls, typecheck/TcClassDcl: Most of the rest of the generics-related code * hsSyn/HsTypes: New infix type form to allow types of the form data a :+: b = Inl a | Inr b * parser/Parser.y, Lex.lhs, rename/ParseIface.y: Deal with the new syntax * prelude/TysPrim, TysWiredIn: Need to generate generic stuff for the wired-in TyCons * rename/RnSource RnBinds: A rather gruesome hack to deal with scoping of type variables from a generic patterns. Details commented in the ClassDecl case of RnSource.rnDecl. Of course, there are many minor renamer consequences of the other changes above. * lib/std/PrelBase.lhs Data type declarations for Unit, :+:, :*: Slightly unrelated housekeeping ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * hsSyn/HsDecls: ClassDecls now carry the Names for their implied declarations (superclass selectors, tycon, etc) in a list, rather than laid out one by one. This simplifies code between the parser and the type checker. * prelude/PrelNames, TysWiredIn: All the RdrNames are now together in PrelNames. * utils/ListSetOps: Add finite mappings based on equality and association lists (Assoc a b) Move stuff from List.lhs that is related
-
- 28 Sep, 2000 1 commit
-
-
simonpj authored
------------------------------------ Mainly PredTypes (28 Sept 00) ------------------------------------ Three things in this commit: 1. Main thing: tidy up PredTypes 2. Move all Keys into PrelNames 3. Check for unboxed tuples in function args 1. Tidy up PredTypes ~~~~~~~~~~~~~~~~~~~~ The main thing in this commit is to modify the representation of Types so that they are a (much) better for the qualified-type world. This should simplify Jeff's life as he proceeds with implicit parameters and functional dependencies. In particular, PredType, introduced by Jeff, is now blessed and dignified with a place in TypeRep.lhs: data PredType = Class Class [Type] | IParam Name Type Consider these examples: f :: (Eq a) => a -> Int g :: (?x :: Int -> Int) => a -> Int h :: (r\l) => {r} => {l::Int | r} Here the "Eq a" and "?x :: Int -> Int" and "r\l" are all called *predicates*, and are represented by a PredType. (We don't support TREX records yet, but the setup is designed to expand to allow them.) In addition, Type gains an extra constructor: data Type = .... | PredTy PredType so that PredType is injected directly into Type. So the type p => t is represented by PredType p `FunTy` t I have deleted the hackish IPNote stuff; predicates are dealt with entirely through PredTys, not through NoteTy at all. 2. Move Keys into PrelNames ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is just a housekeeping operation. I've moved all the pre-assigned Uniques (aka Keys) from Unique.lhs into PrelNames.lhs. I've also moved knowKeyRdrNames from PrelInfo down into PrelNames. This localises in PrelNames lots of stuff about predefined names. Previously one had to alter three files to add one, now only one. 3. Unboxed tuples ~~~~~~~~~~~~~~~~~~ Add a static check for unboxed tuple arguments. E.g. data T = T (# Int, Int #) is illegal
-