1. 26 Nov, 2001 3 commits
    • simonpj's avatar
      [project @ 2001-11-26 10:33:40 by simonpj] · 5a1ac8dc
      simonpj authored
      Complete previous tcAddImportedIdInfo commit
      5a1ac8dc
    • simonpj's avatar
      [project @ 2001-11-26 10:26:59 by simonpj] · 1fdd97b6
      simonpj authored
      --------------------------------------
      	Finally get rid of tcAddImportedIdInfo
      	--------------------------------------
      
      TcEnv.tcAddImportedIdInfo is a notorious source of space leaks.
      Simon M got rid of the need for it on default methods.
      This commit gets rid of the need for it for dictionary function Ids,
      and finally nukes the beast altogether. Hurrah!
      
      The change really involves putting tcInterfaceSigs *before*
      tcInstDecls1, so that any imported DFunIds are in the typechecker's
      environment before we get to tcInstDecls.
      1fdd97b6
    • simonpj's avatar
      [project @ 2001-11-26 09:20:25 by simonpj] · 5e3f005d
      simonpj authored
      ----------------------
      	Implement Rank-N types
      	----------------------
      
      This commit implements the full glory of Rank-N types, using
      the Odersky/Laufer approach described in their paper
      	"Putting type annotations to work"
      
      In fact, I've had to adapt their approach to deal with the
      full glory of Haskell (including pattern matching, and the
      scoped-type-variable extension).  However, the result is:
      
      * There is no restriction to rank-2 types.  You can nest forall's
        as deep as you like in a type.  For example, you can write a type
        like
      	p :: ((forall a. Eq a => a->a) -> Int) -> Int
        This is a rank-3 type, illegal in GHC 5.02
      
      * When matching types, GHC uses the cunning Odersky/Laufer coercion
        rules.  For example, suppose we have
      	q :: (forall c. Ord c => c->c) -> Int
        Then, is this well typed?
      	x :: Int
      	x = p q
        Yes, it is, but GHC has to generate the right coercion.  Here's
        what it looks like with all the big lambdas and dictionaries put in:
      
      	x = p (\ f :: (forall a. Eq a => a->a) ->
      		 q (/\c \d::Ord c -> f c (eqFromOrd d)))
      
        where eqFromOrd selects the Eq superclass dictionary from the Ord
        dicationary:		eqFromOrd :: Ord a -> Eq a
      
      
      * You can use polymorphic types in pattern type signatures.  For
        example:
      
      	f (g :: forall a. a->a) = (g 'c', g True)
      
        (Previously, pattern type signatures had to be monotypes.)
      
      * The basic rule for using rank-N types is that you must specify
        a type signature for every binder that you want to have a type
        scheme (as opposed to a plain monotype) as its type.
      
        However, you don't need to give the type signature on the
        binder (as I did above in the defn for f).  You can give it
        in a separate type signature, thus:
      
      	f :: (forall a. a->a) -> (Char,Bool)
      	f g = (g 'c', g True)
      
        GHC will push the external type signature inwards, and use
        that information to decorate the binders as it comes across them.
        I don't have a *precise* specification of this process, but I
        think it is obvious enough in practice.
      
      * In a type synonym you can use rank-N types too.  For example,
        you can write
      
      	type IdFun = forall a. a->a
      
      	f :: IdFun -> (Char,Bool)
      	f g = (g 'c', g True)
      
        As always, type synonyms must always occur saturated; GHC
        expands them before it does anything else.  (Still, GHC goes
        to some trouble to keep them unexpanded in error message.)
      
      
      The main plan is as before.  The main typechecker for expressions,
      tcExpr, takes an "expected type" as its argument.  This greatly
      improves error messages.  The new feature is that when this
      "expected type" (going down) meets an "actual type" (coming up)
      we use the new subsumption function
      	TcUnify.tcSub
      which checks that the actual type can be coerced into the
      expected type (and produces a coercion function to demonstrate).
      
      The main new chunk of code is TcUnify.tcSub.  The unifier itself
      is unchanged, but it has moved from TcMType into TcUnify.  Also
      checkSigTyVars has moved from TcMonoType into TcUnify.
      Result: the new module, TcUnify, contains all stuff relevant
      to subsumption and unification.
      
      Unfortunately, there is now an inevitable loop between TcUnify
      and TcSimplify, but that's just too bad (a simple TcUnify.hi-boot
      file).
      
      
      All of this doesn't come entirely for free.  Here's the typechecker
      line count (INCLUDING comments)
      	Before	16,551
      	After	17,116
      5e3f005d
  2. 23 Nov, 2001 1 commit
    • simonmar's avatar
      [project @ 2001-11-23 12:06:49 by simonmar] · dd823536
      simonmar authored
      Use (DefMeth Name) rather than (DefMeth Id) in ClassOpItem.  This not
      only eliminates a space leak, because Names generally hold on to much
      less stuff than Ids, but also turns out to be a minor cleanup.
      dd823536
  3. 31 Oct, 2001 1 commit
    • simonpj's avatar
      [project @ 2001-10-31 15:22:53 by simonpj] · 61bfd5dd
      simonpj authored
      ------------------------------------------
      	Improved handling of scoped type variables
      	------------------------------------------
      
      The main effect of this commit is to allow scoped type variables
      in pattern bindings, thus
      
      	(x::a, y::b) = e
      
      This was illegal, but now it's ok.  a and b have the same scope
      as x and y.
      
      
      On the way I beefed up the info inside a type variable
      (TcType.TyVarDetails; c.f. IdInfo.GlobalIdDetails) which
      helps to improve error messages. Hence the wide ranging changes.
      Pity about the extra loop from Var to TcType, but can't be helped.
      61bfd5dd
  4. 25 Oct, 2001 1 commit
    • sof's avatar
      [project @ 2001-10-25 02:13:10 by sof] · 9e933350
      sof authored
      - Pet peeve removal / code tidyup, replaced various sub-optimal
        uses of 'length' with something a bit better, i.e., replaced
        the following patterns
      
         *  length as `cmpOp` length bs
         *  length as `cmpOp` val   -- incl. uses where val == 1 and val == 0
         *  {take,drop,splitAt} (length as) bs
         *  length [ () | pat <- as ]
      
        with uses of misc Util functions.
      
        I'd be surprised if there's a noticeable reduction in running
        times as a result of these changes, but every little bit helps.
      
        [ The changes have been tested wrt testsuite/ - I'm seeing a couple
          of unexpected breakages coming from CorePrep, but I'm currently
          assuming that these are due to other recent changes. ]
      
      - compMan/CompManager.lhs: restored 4.08 compilability + some code
        cleanup.
      
      None of these changes are HEADworthy.
      9e933350
  5. 26 Sep, 2001 1 commit
    • simonpj's avatar
      [project @ 2001-09-26 15:12:33 by simonpj] · e0d750be
      simonpj authored
      ------------------
      		Simon's big commit
      		------------------
      
      This commit, which I don't think I can sensibly do piecemeal, consists
      of the things I've been doing recently, mainly directed at making
      Manuel, George, and Marcin happier with RULES.
      
      
      Reogranise the simplifier
      ~~~~~~~~~~~~~~~~~~~~~~~~~
      1. The simplifier's environment is now an explicit parameter.  This
      makes it a bit easier to figure out where it is going.
      
      2. Constructor arguments can now be arbitrary expressions, except
      when the application is the RHS of a let(rec).  This makes it much
      easier to match rules like
      
      	RULES
      	    "foo"  f (h x, g y) = f' x y
      
      In the simplifier, it's Simplify.mkAtomicArgs that ANF-ises a
      constructor application where necessary.  In the occurrence analyser,
      there's a new piece of context info (OccEncl) to say whether a
      constructor app is in a place where it should be in ANF.  (Unless
      it knows this it'll give occurrence info which will inline the
      argument back into the constructor app.)
      
      3. I'm experimenting with doing the "float-past big lambda" transformation
      in the full laziness pass, rather than mixed in with the simplifier (was
      tryRhsTyLam).
      
      4.  Arrange that
      	case (coerce (S,T) (x,y)) of ...
      will simplify.  Previous it didn't.
      A local change to CoreUtils.exprIsConApp_maybe.
      
      5. Do a better job in CoreUtils.exprEtaExpandArity when there's an
      error function in one branch.
      
      
      Phase numbers, RULES, and INLINE pragmas
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      1.  Phase numbers decrease from N towards zero (instead of increasing).
      This makes it easier to add new earlier phases, which is what users want
      to do.
      
      2.  RULES get their own phase number, N, and are disabled in phases before N.
      
      e.g. 	{-# RULES "foo" [2] forall x y.  f (x,y) = f' x y #-}
      
      Note the [2], which says "only active in phase 2 and later".
      
      3.  INLINE and NOINLINE pragmas have a phase number to.  This is now treated
      in just the same way as the phase number on RULE; that is, the Id is not inlined
      in phases earlier than N.  In phase N and later the Id *may* be inlined, and
      here is where INLINE and NOINLINE differ: INLNE makes the RHS look small, so
      as soon as it *may* be inlined it probably *will* be inlined.
      
      The syntax of the phase number on an INLINE/NOINLINE pragma has changed to be
      like the RULES case (i.e. in square brackets).  This should also make sure
      you examine all such phase numbers; many will need to change now the numbering
      is reversed.
      
      Inlining Ids is no longer affected at all by whether the Id appears on the
      LHS of a rule.  Now it's up to the programmer to put a suitable INLINE/NOINLINE
      pragma to stop it being inlined too early.
      
      
      Implementation notes:
      
      *  A new data type, BasicTypes.Activation says when a rule or inline pragma
      is active.   Functions isAlwaysActive, isNeverActive, isActive, do the
      obvious thing (all in BasicTypes).
      
      * Slight change in the SimplifierSwitch data type, which led to a lot of
      simplifier-specific code moving from CmdLineOpts to SimplMonad; a Good Thing.
      
      * The InlinePragma in the IdInfo of an Id is now simply an Activation saying
      when the Id can be inlined.  (It used to be a rather bizarre pair of a
      Bool and a (Maybe Phase), so this is much much easier to understand.)
      
      * The simplifier has a "mode" environment switch, replacing the old
      black list.  Unfortunately the data type decl has to be in
      CmdLineOpts, because it's an argument to the CoreDoSimplify switch
      
          data SimplifierMode = SimplGently | SimplPhase Int
      
      Here "gently" means "no rules, no inlining".   All the crucial
      inlining decisions are now collected together in SimplMonad
      (preInlineUnconditionally, postInlineUnconditionally, activeInline,
      activeRule).
      
      
      Specialisation
      ~~~~~~~~~~~~~~
      1.  Only dictionary *functions* are made INLINE, not dictionaries that
      have no parameters.  (This inline-dictionary-function thing is Marcin's
      idea and I'm still not sure whether it's a good idea.  But it's definitely
      a Bad Idea when there are no arguments.)
      
      2.  Be prepared to specialise an INLINE function: an easy fix in
      Specialise.lhs
      
      But there is still a problem, which is that the INLINE wins
      at the call site, so we don't use the specialised version anyway.
      I'm still unsure whether it makes sense to SPECIALISE something
      you want to INLINE.
      
      
      
      
      
      Random smaller things
      ~~~~~~~~~~~~~~~~~~~~~~
      
      * builtinRules (there was only one, but may be more) in PrelRules are now
        incorporated.   They were being ignored before...
      
      * OrdList.foldOL -->  OrdList.foldrOL, OrdList.foldlOL
      
      * Some tidying up of the tidyOpenTyVar, tidyTyVar functions.  I've
        forgotten exactly what!
      e0d750be
  6. 07 Sep, 2001 1 commit
    • simonpj's avatar
      [project @ 2001-09-07 12:44:30 by simonpj] · 991a868b
      simonpj authored
      ----------------------------------------
      	Make dict funs and default methods
      	into LocalIds only at their binding site
      	----------------------------------------
              [part of 3 related commits]
      
      There's a long comment about this with MkId.mkDefaultMethodId,
      which I reproduce below.
      
      While I was at it, I renamed setIdNoDiscard to setIdLocalExported.
      Which is hardly an improvement, I'm afraid.  This renaming touches
      	Var.lhs, Id.lhs, SimplCore.lhs
      in a trivial way.
      
      	---------------------
      
      Dict funs and default methods are *not* ImplicitIds.  Their definition
      involves user-written code, so we can't figure out their strictness etc
      based on fixed info, as we can for constructors and record selectors (say).
      
      We build them as GlobalIds, but when in the module where they are
      bound, we turn the Id at the *binding site* into an exported LocalId.
      This ensures that they are taken to account by free-variable finding
      and dependency analysis (e.g. CoreFVs.exprFreeVars).   The simplifier
      will propagate the LocalId to all occurrence sites.
      
      Why shouldn't they be bound as GlobalIds?  Because, in particular, if
      they are globals, the specialiser floats dict uses above their defns,
      which prevents good simplifications happening.  Also the strictness
      analyser treats a occurrence of a GlobalId as imported and assumes it
      contains strictness in its IdInfo, which isn't true if the thing is
      bound in the same module as the occurrence.
      
      It's OK for dfuns to be LocalIds, because we form the instance-env to
      pass on to the next module (md_insts) in CoreTidy, afer tidying
      and globalising the top-level Ids.
      
      BUT make sure they are *exported* LocalIds (setIdLocalExported) so
      that they aren't discarded by the occurrence analyser.
      991a868b
  7. 21 Aug, 2001 1 commit
  8. 14 Aug, 2001 1 commit
    • simonpj's avatar
      [project @ 2001-08-14 06:35:56 by simonpj] · 2767767f
      simonpj authored
      1. Arrange that w/w records unfoldings
         And that the simplifier preserves them
      
      2. Greatly improve structure of checking user types in the typechecker
         Main changes:
      	TcMType.checkValidType checks for a valid type
      	TcMonoType.tcHsSigType uses checkValidType
      	Type and class decls use TcMonoType.tcHsType (which does not
      		check for validity) inside the knot in TcTyClsDecls,
      		and then runs TcTyDecls.checkValidTyCon
      		or TcClassDcl.checkValidClass to check for validity
      		once the knot is tied
      2767767f
  9. 27 Jun, 2001 1 commit
  10. 25 Jun, 2001 1 commit
    • simonpj's avatar
      [project @ 2001-06-25 08:09:57 by simonpj] · d069cec2
      simonpj authored
      ----------------
      	Squash newtypes
      	----------------
      
      This commit squashes newtypes and their coerces, from the typechecker
      onwards.  The original idea was that the coerces would not get in the
      way of optimising transformations, but despite much effort they continue
      to do so.   There's no very good reason to retain newtype information
      beyond the typechecker, so now we don't.
      
      Main points:
      
      * The post-typechecker suite of Type-manipulating functions is in
      types/Type.lhs, as before.   But now there's a new suite in types/TcType.lhs.
      The difference is that in the former, newtype are transparent, while in
      the latter they are opaque.  The typechecker should only import TcType,
      not Type.
      
      * The operations in TcType are all non-monadic, and most of them start with
      "tc" (e.g. tcSplitTyConApp).  All the monadic operations (used exclusively
      by the typechecker) are in a new module, typecheck/TcMType.lhs
      
      * I've grouped newtypes with predicate types, thus:
      	data Type = TyVarTy Tyvar | ....
      		  | SourceTy SourceType
      
      	data SourceType = NType TyCon [Type]
      			| ClassP Class [Type]
      			| IParam Type
      
      [SourceType was called PredType.]  This is a little wierd in some ways,
      because NTypes can't occur in qualified types.   However, the idea is that
      a SourceType is a type that is opaque to the type checker, but transparent
      to the rest of the compiler, and newtypes fit that as do implicit parameters
      and dictionaries.
      
      * Recursive newtypes still retain their coreces, exactly as before. If
      they were transparent we'd get a recursive type, and that would make
      various bits of the compiler diverge (e.g. things which do type comparison).
      
      * I've removed types/Unify.lhs (non-monadic type unifier and matcher),
      merging it into TcType.
      
      Ditto typecheck/TcUnify.lhs (monadic unifier), merging it into TcMType.
      d069cec2
  11. 24 May, 2001 1 commit
    • simonpj's avatar
      [project @ 2001-05-24 13:59:09 by simonpj] · cbdeae8f
      simonpj authored
      ------------------------------------------------------
      	More stuff towards generalising 'foreign' declarations
      	------------------------------------------------------
      
      This is the second step towards generalising 'foreign' declarations to
      handle langauges other than C.  Now I can handle
      
        foreign import dotnet type T
        foreign import dotnet "void Foo.Baz.f( T )" f :: T -> IO ()
      
      
      
      			** WARNING **
      	I believe that all the foreign stuff for C should
      	work exactly as before, but I have not tested it
      	thoroughly.  Sven, Manuel, Marcin: please give it a
      	whirl and compare old with new output.
      
      
      Lots of fiddling around with data types.  The main changes are
      
      * HsDecls.lhs
      	The ForeignDecl type and its friends
      	Note also the ForeignType constructor to TyClDecl
      
      * ForeignCall.lhs
      	Here's where the stuff that survives right through
      	compilation lives
      
      * TcForeign.lhs DsForeign.lhs
      	Substantial changes driven by the new data types
      
      * Parser.y ParseIface.y RnSource
      	Just what you'd expect
      cbdeae8f
  12. 22 May, 2001 1 commit
    • simonpj's avatar
      [project @ 2001-05-22 13:43:14 by simonpj] · f16228e4
      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.
      f16228e4
  13. 21 May, 2001 1 commit
    • simonpj's avatar
      [project @ 2001-05-21 09:19:14 by simonpj] · c7e7bc25
      simonpj authored
      -------------------------------
      	Improve pattern type-signatures
      	-------------------------------
      
      The main effect of this commit is to implement the idea (originally
      Marcin's suggestion) that type variables in pattern type signatures
      are simply names for types; they don't have to name a type that is
      itself a type variable.
      
      For example
      
      	f :: Int -> Int
      	f (x::a) = let  y::a
      			y = x
      		   in x+y
      
      is fine.  Here 'a' is a name for the type 'Int', and does not have
      to be universally quantified.
      
      
      I also took the opportunity to modularise the implementation of
      pattern type-checking, mainly in TcMatches.  As a result pattern type
      signatures should work in do-notation (which they didn't before).
      
      ToDo: update documentation
      c7e7bc25
  14. 04 May, 2001 2 commits
  15. 03 May, 2001 1 commit
  16. 01 May, 2001 1 commit
  17. 30 Apr, 2001 1 commit
  18. 14 Apr, 2001 1 commit
  19. 13 Mar, 2001 1 commit
    • simonpj's avatar
      [project @ 2001-03-13 14:58:25 by simonpj] · 788faebb
      simonpj authored
      ----------------
      	Nuke ClassContext
      	----------------
      
      This commit tidies up a long-standing inconsistency in GHC.
      The context of a class or instance decl used to be restricted
      to predicates of the form
      	C t1 .. tn
      with
      	type ClassContext = [(Class,[Type])]
      
      but everywhere else in the compiler we used
      
      	type ThetaType = [PredType]
      where PredType can be any sort of constraint (= predicate).
      
      The inconsistency actually led to a crash, when compiling
      	class (?x::Int) => C a where {}
      
      I've tidied all this up by nuking ClassContext altogether, and using
      PredType throughout.  Lots of modified files, but all in
      more-or-less trivial ways.
      
      I've also added a check that the context of a class or instance
      decl doesn't include a non-inheritable predicate like (?x::Int).
      
      Other things
      
       * rename constructor 'Class' from type TypeRep.Pred to 'ClassP'
         (makes it easier to grep for)
      
       * rename constructor HsPClass  => HsClassP
      		      HsPIParam => HsIParam
      788faebb
  20. 26 Feb, 2001 1 commit
  21. 23 Feb, 2001 1 commit
  22. 20 Feb, 2001 1 commit
    • simonpj's avatar
      [project @ 2001-02-20 09:42:50 by simonpj] · 22ffc06a
      simonpj authored
      Typechecking [TcModule, TcBinds, TcHsSyn, TcInstDcls, TcSimplify]
      ~~~~~~~~~~~~
      * Fix a bug in TcSimplify that broke functional dependencies.
        Interleaving unification and context reduction is trickier 
        than I thought.  Comments in the code amplify.  
      
      * Fix a functional-dependency bug, that meant that this pgm:
      	class C a b | a -> b where f :: a -> b
      	
      	g :: (C a b, Eq b) => a -> Bool
      	g x = f x == f x
        gave an ambiguity error report.  I'm afraid I've forgotten
        what the problem was.
      
      
      * Correct the implementation of the monomorphism restriction,
        in TcBinds.generalise.  This fixes Marcin's bug report:
      	test1 :: Eq a => a -> b -> b
      	test1 x y = y
      
      	test2 = test1 (3::Int)
        Previously we were erroneously inferring test2 :: () -> ()
      
      * Make the "unf_env" that is looped round in TcModule go round
        in a big loop, not just round tcImports.  This matters when
        we have mutually recursive modules, so that the Ids bound in
        the source code may appear in the imports.  Sigh.  But no big
        deal.
      
        It does mean that you have to be careful not to call isLocalId,
        isDataConId etc, because they consult the IdInfo of an Id, which 
        in turn may be determined by the loop-tied unf_env.
      22ffc06a
  23. 29 Jan, 2001 1 commit
    • simonpj's avatar
      [project @ 2001-01-29 08:42:54 by simonpj] · 9c848a68
      simonpj authored
      Be a bit more liberal about allowing instance decls through.
      In particular, allow this:
      
      	instance C a b => C [a] [b] where ...
      
      if we have
      
      	class C a b | a -> b
      
      This is an experimental feature. Furthermore it requires a 
      little more work (which I have not yet done) to make improvement
      work properly.
      9c848a68
  24. 25 Jan, 2001 1 commit
    • simonpj's avatar
      [project @ 2001-01-25 17:54:24 by simonpj] · 4e342297
      simonpj authored
      ------------------------------------
      	   Mainly FunDeps (23 Jan 01)
      	------------------------------------
      
      This commit re-engineers the handling of functional dependencies.
      A functional dependency is no longer an Inst; instead, the necessary
      dependencies are snaffled out of their Class when necessary.
      
      As part of this exercise I found that I had to re-work how to do generalisation
      in a binding group.  There is rather exhaustive documentation on the new Plan
      at the top of TcSimplify.
      
      	******************
      	WARNING: I have compiled all the libraries with this new compiler
      		 and all looks well, but I have not run many programs.
      		 Things may break.  Let me know if so.
      	******************
      
      The main changes are these:
      
      1.  typecheck/TcBinds and TcSimplify have a lot of changes due to the
          new generalisation and context reduction story.  There are extensive
          comments at the start of TcSimplify
      
      2.  typecheck/TcImprove is removed altogether.  Instead, improvement is
          interleaved with context reduction (until a fixpoint is reached).
          All this is done in TcSimplify.
      
      3.  types/FunDeps has new exports
      	* 'improve' does improvement, returning a list of equations
      	* 'grow' and 'oclose' close a list of type variables wrt a set of
      	  PredTypes, but in slightly different ways.  Comments in file.
      
      4.  I improved the way in which we check that main::IO t.  It's tidier now.
      
      In addition
      
      *   typecheck/TcMatches:
      	a) Tidy up, introducing a common function tcCheckExistentialPat
      
      	b) Improve the typechecking of parallel list comprehensions,
      	   which wasn't quite right before.  (see comments with tcStmts)
      
      	WARNING: (b) is untested!  Jeff, you might want to check.
      
      *   Numerous other incidental changes in the typechecker
      
      *   Manuel found that rules don't fire well when you have partial applications
          from overloading.  For example, we may get
      
      	f a (d::Ord a) = let m_g = g a d
      			 in
      			 \y :: a -> ...(m_g (h y))...
      
          The 'method' m_g doesn't get inlined because (g a d) might be a redex.
          Yet a rule that looks like
      		g a d (h y) = ...
          won't fire because that doesn't show up.  One way out would be to make
          the rule matcher a bit less paranoid about duplicating work, but instead
          I've added a flag
      			-fno-method-sharing
          which controls whether we generate things like m_g in the first place.
          It's not clear that they are a win in the first place.
      
          The flag is actually consulted in Inst.tcInstId
      4e342297
  25. 11 Jan, 2001 1 commit
    • simonmar's avatar
      [project @ 2001-01-11 17:25:56 by simonmar] · efa88123
      simonmar authored
      Re-organisation of ghc/lib/std and hslibs/lang
      ----------------------------------------------
      
      In brief: move deprecated features out of ghc/lib/std and into
      hslibs/lang, move new FFI libraries into ghc/lib/std and start
      using them.
      
      - foreign import may now return an unboxed type (this was
        advertised to work before, but in fact didn't).  Subsequent
        cleanups in PrelInt/PrelWord.
      
      - Ptr is now defined in ghc/lib/std/PrelPtr.lhs.  Ptr is no
        longer a newtype of Addr, it is defined directly in terms of
        Addr#.
      
      - PrelAddr has disappeared from ghc/lib/std, all uses of Addr in
        ghc/lib/std have been replaced with Ptr.  The definitions of
        Addr has been moved to hslibs/lang/Addr.lhs, as has
        lots of other Addr-related stuff.
      
      - ForeignObj has been removed from ghc/lib/std, and replaced with
        ForeignPtr.  The definition of ForeignObj has been moved to
        hslibs/lang/ForeignObj.lhs.
      
      - Most of the new FFI has been moved into ghc/lib/std in the form
        of modules PrelMarshalAlloc, PrelCString, PrelCError,
        PrelMarshalError, PrelMarshalArray, PrelMarshalUtils,
        PrelCTypes, PrelCTypesISO, and PrelStorable.  The corresponding
        modules in hslibs/lang simply re-export the contents of these
        modules.
      
      - PrelPosixTypes defines a few POSIX types (CMode == mode_t,
        etc.)
      
      - PrelCError changed to access errno using foreign label and peek
        (the POSIX book I have says that errno is guaranteed to be an
        extern int, so this should be OK until I get around to making
        errno thread-safe).
      
      - Hacked the macros that generate the code for CTypes and
        CTypesISO to generate much less code
        (ghc/lib/std/cbits/CTypes.h).
      
      - RtsAPI is now a bit more honest when it comes to building heap
        objects (it uses the correct constructors).
      
      - the Bits class and related stuff has been moved to ghc/lib/std
        (it was simpler this way).
      
      - Directory and System have been converted to use the new FFI.
      efa88123
  26. 30 Nov, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-11-30 15:46:01 by simonpj] · 28561da9
      simonpj authored
      Make the tests for -fglasgow-exts apply only to source code.
        If you merely import a module that uses (say) multi-parameter
        type classes internally, you shouldn't need -fglasgow-exts.
      
        There were surprisingly few places to change.
      28561da9
  27. 24 Nov, 2000 2 commits
    • simonpj's avatar
      [project @ 2000-11-24 17:02:01 by simonpj] · 83eef621
      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.
      83eef621
    • simonpj's avatar
      [project @ 2000-11-24 09:51:38 by simonpj] · 4166dff8
      simonpj authored
      Unused imports and suchlike
      4166dff8
  28. 21 Nov, 2000 2 commits
  29. 20 Nov, 2000 2 commits
    • simonpj's avatar
      [project @ 2000-11-20 16:07:12 by simonpj] · d00cf5b8
      simonpj authored
      Remember local decls when no recompilation is required
      d00cf5b8
    • simonpj's avatar
      [project @ 2000-11-20 14:48:52 by simonpj] · c271b647
      simonpj authored
      When renaming, typechecking an expression from the user
      interface, we may suck in declarations from interface
      files (e.g. the Prelude).  This commit takes account of that.
      
      To do so, I did some significant restructuring in TcModule,
      with consequential changes and tidy ups elsewhere in the type
      checker.  I think there should be fewer lines in total than before.
      c271b647
  30. 10 Nov, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-11-10 15:12:50 by simonpj] · f23ba2b2
      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
      f23ba2b2
  31. 08 Nov, 2000 1 commit
  32. 07 Nov, 2000 1 commit
  33. 06 Nov, 2000 1 commit
  34. 31 Oct, 2000 1 commit