1. 12 Jan, 2011 1 commit
    • simonpj@microsoft.com's avatar
      Major refactoring of the type inference engine · 27310213
      simonpj@microsoft.com authored
      This patch embodies many, many changes to the contraint solver, which
      make it simpler, more robust, and more beautiful.  But it has taken
      me ages to get right. The forcing issue was some obscure programs
      involving recursive dictionaries, but these eventually led to a
      massive refactoring sweep.
      Main changes are:
       * No more "frozen errors" in the monad.  Instead "insoluble
         constraints" are now part of the WantedConstraints type.
       * The WantedConstraint type is a product of bags, instead of (as
         before) a bag of sums.  This eliminates a good deal of tagging and
       * This same WantedConstraints data type is used
           - As the way that constraints are gathered
           - As a field of an implication constraint
           - As both argument and result of solveWanted
           - As the argument to reportUnsolved
       * We do not generate any evidence for Derived constraints. They are
         purely there to allow "impovement" by unifying unification
       * In consequence, nothing is ever *rewritten* by a Derived
         constraint.  This removes, by construction, all the horrible
         potential recursive-dictionary loops that were making us tear our
         hair out.  No more isGoodRecEv search either. Hurrah!
       * We add the superclass Derived constraints during canonicalisation,
         after checking for duplicates.  So fewer superclass constraints
         are generated than before.
       * Skolem tc-tyvars no longer carry SkolemInfo.  Instead, the
         SkolemInfo lives in the GivenLoc of the Implication, where it
         can be tidied, zonked, and substituted nicely.  This alone is
         a major improvement.
       * Tidying is improved, so that we tend to get t1, t2, t3, rather
         than t1, t11, t111, etc
         Moreover, unification variables are always printed with a digit
         (thus a0, a1, etc), so that plain 'a' is available for a skolem
         arising from a type signature etc. In this way,
           (a) We quietly say which variables are unification variables,
               for those who know and care
           (b) Types tend to get printed as the user expects.  If he writes
                   f :: a -> a
                   f = ...blah...
               then types involving 'a' get printed with 'a', rather than
               some tidied variant.
       * There are significant improvements in error messages, notably
         in the "Cannot deduce X from Y" messages.
  2. 22 Oct, 2010 1 commit
    • simonpj@microsoft.com's avatar
      Add rebindable syntax for if-then-else · 4e0c994e
      simonpj@microsoft.com authored
      There are two main changes
       * New LANGUAGE option RebindableSyntax, which implies NoImplicitPrelude
       * if-the-else becomes rebindable, with function name "ifThenElse"
         (but case expressions are unaffected)
      Thanks to Sam Anklesaria for doing most of the work here
  3. 21 Oct, 2010 1 commit
  4. 13 Sep, 2010 1 commit
  5. 30 Jul, 2010 1 commit
  6. 22 Aug, 2010 1 commit
  7. 06 Jul, 2009 1 commit
  8. 30 Oct, 2008 1 commit
    • simonpj@microsoft.com's avatar
      Improve error reporting for non-rigid GADT matches · 259d5ea8
      simonpj@microsoft.com authored
      Following suggestions from users, this patch improves the error message
      when a GADT match needs a rigid type:
           GADT pattern match in non-rigid context for `Nil'
      -      Solution: add a type signature
      +      Probable solution: add a type signature for `is_normal'
           In the pattern: Nil
           In the definition of `is_normal': is_normal Nil = True
      Now GHC tries to tell you what to give a type signature *for*.
      Thanks to Daniel Gorin and others for the suggestions.
  9. 03 Sep, 2008 1 commit
    • simonpj@microsoft.com's avatar
      Major change in compilation of instance declarations (fix Trac #955, #2328) · f16dbbbe
      simonpj@microsoft.com authored
      This patch makes an important change to the way that dictionary
      functions are handled.  Before, they were unconditionally marked
      INLIINE, but all the code written by the user in the instance
      was inside that unconditionally-inlined function.  Result: massive
      code bloat in programs that use complicated instances.
      This patch make instances behave rather as if all the methods
      were written in separate definitions.  That dramatically reduces
      bloat.  The new plan is described in TcInstDcls
      	Note [How instance declarations are translated]
      Everything validates.  The major code-bloat bug is squashed: in particular
      DoCon is fine now (Trac #2328) and I believe that #955 is also better.
      Nofib results:
      Binary sizes
              -1 s.d.      +2.5%
              +1 s.d.      +3.1%
              Average      +2.8%
              -1 s.d.      -6.4%
              +1 s.d.      +2.5%
              Average      -2.0%
      Note that 2% improvement.  Some programs improve by 20% (rewrite)!
      Two get slightly worse: pic (2.1%), and gameteb (3.2%), but all others
      improve or stay the same.
      I am not absolutely 100% certain that all the corners are correct; for
      example, when default methods are marked INLINE, are they inlined?  But
      overall it's better.
      It's nice that the patch also removes a lot of code.  I deleted some
      out of date comments, but there's something like 100 fewer lines of
      code in the new version!  (In the line counts below, there are a lot
      of new comments.)
  10. 04 Jun, 2008 1 commit
  11. 06 May, 2008 1 commit
  12. 12 Apr, 2008 1 commit
  13. 29 Mar, 2008 1 commit
  14. 29 Feb, 2008 1 commit
  15. 28 Feb, 2008 1 commit
    • chak@cse.unsw.edu.au.'s avatar
      Remove GADT refinements, part 1 · 4226903d
      chak@cse.unsw.edu.au. authored
      - A while ago, I changed the type checker to use equality constraints together
        with implication constraints to track local type refinement due to GADT
        pattern matching.  This patch is the first of a number of surgical strikes
        to remove the resulting dead code of the previous GADT refinement machinery.
        Hurray to code simplification!
  16. 26 Feb, 2008 1 commit
  17. 17 Jan, 2008 1 commit
  18. 14 Nov, 2007 1 commit
  19. 10 Oct, 2007 1 commit
    • Dan Licata's avatar
      View patterns, record wildcards, and record puns · 6a05ec5e
      Dan Licata authored
      This patch implements three new features:
      * view patterns (syntax: expression -> pat in a pattern)
      * working versions of record wildcards and record puns
      See the manual for detailed descriptions.
      Other minor observable changes:
      * There is a check prohibiting local fixity declarations
        when the variable being fixed is not defined in the same let
      * The warn-unused-binds option now reports warnings for do and mdo stmts
      Implementation notes: 
      * The pattern renamer is now in its own module, RnPat, and the
      implementation is now in a CPS style so that the correct context is
      delivered to pattern expressions.
      * These features required a fairly major upheaval to the renamer.
      Whereas the old version used to collect up all the bindings from a let
      (or top-level, or recursive do statement, ...) and put them into scope
      before renaming anything, the new version does the collection as it
      renames.  This allows us to do the right thing with record wildcard
      patterns (which need to be expanded to see what names should be
      collected), and it allows us to implement the desired semantics for view
      patterns in lets.  This change had a bunch of domino effects brought on
      by fiddling with the top-level renaming.
      * Prior to this patch, there was a tricky bug in mkRecordSelId in HEAD,
      which did not maintain the invariant necessary for loadDecl.  See note
      [Tricky iface loop] for details.
  20. 28 Sep, 2007 1 commit
  21. 04 Sep, 2007 1 commit
  22. 03 Sep, 2007 1 commit
  23. 01 Sep, 2007 1 commit
  24. 10 Nov, 2006 1 commit
  25. 11 Oct, 2006 1 commit
    • Simon Marlow's avatar
      Module header tidyup, phase 1 · 49c98d14
      Simon Marlow authored
      This patch is a start on removing import lists and generally tidying
      up the top of each module.  In addition to removing import lists:
         - Change DATA.IOREF -> Data.IORef etc.
         - Change List -> Data.List etc.
         - Remove $Id$
         - Update copyrights
         - Re-order imports to put non-GHC imports last
         - Remove some unused and duplicate imports
  26. 29 Sep, 2006 1 commit
  27. 20 Sep, 2006 2 commits
    • chak@cse.unsw.edu.au.'s avatar
      Complete the evidence generation for GADTs · 15cb792d
      chak@cse.unsw.edu.au. authored
      Mon Sep 18 14:43:22 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * Complete the evidence generation for GADTs
        Sat Aug  5 21:39:51 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * Complete the evidence generation for GADTs
          Thu Jul 13 17:18:07 EDT 2006  simonpj@microsoft.com
            This patch completes FC evidence generation for GADTs.
            It doesn't work properly yet, because part of the compiler thinks
            	(t1 :=: t2) => t3
            is represented with FunTy/PredTy, while the rest thinks it's represented
            using ForAllTy.  Once that's done things should start to work.
    • chak@cse.unsw.edu.au.'s avatar
      Massive patch for the first months work adding System FC to GHC #34 · 3e83dfb2
      chak@cse.unsw.edu.au. authored
      Fri Sep 15 18:56:58 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * Massive patch for the first months work adding System FC to GHC #34
        Fri Aug  4 18:20:57 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * Massive patch for the first months work adding System FC to GHC #34
          Broken up massive patch -=chak
          Original log message:  
          This is (sadly) all done in one patch to avoid Darcs bugs.
          It's not complete work... more FC stuff to come.  A compiler
          using just this patch will fail dismally.
  28. 07 Apr, 2006 1 commit
    • Simon Marlow's avatar
      Reorganisation of the source tree · 0065d5ab
      Simon Marlow authored
      Most of the other users of the fptools build system have migrated to
      Cabal, and with the move to darcs we can now flatten the source tree
      without losing history, so here goes.
      The main change is that the ghc/ subdir is gone, and most of what it
      contained is now at the top level.  The build system now makes no
      pretense at being multi-project, it is just the GHC build system.
      No doubt this will break many things, and there will be a period of
      instability while we fix the dependencies.  A straightforward build
      should work, but I haven't yet fixed binary/source distributions.
      Changes to the Building Guide will follow, too.
  29. 25 Jan, 2006 1 commit
    • simonpj@microsoft.com's avatar
      Simon's big boxy-type commit · ac10f840
      simonpj@microsoft.com authored
      This very large commit adds impredicativity to GHC, plus
      numerous other small things.
      *** WARNING: I have compiled all the libraries, and
      ***	     a stage-2 compiler, and everything seems
      ***	     fine.  But don't grab this patch if you 
      ***	     can't tolerate a hiccup if something is
      ***	     broken.
      The big picture is this:
      a) GHC handles impredicative polymorphism, as described in the
         "Boxy types: type inference for higher-rank types and
         impredicativity" paper
      b) GHC handles GADTs in the new simplified (and very sligtly less
         epxrssive) way described in the
         "Simple unification-based type inference for GADTs" paper
      But there are lots of smaller changes, and since it was pre-Darcs
      they are not individually recorded.
      Some things to watch out for:
      c)   The story on lexically-scoped type variables has changed, as per
           my email.  I append the story below for completeness, but I 
           am still not happy with it, and it may change again.  In particular,
           the new story does not allow a pattern-bound scoped type variable
           to be wobbly, so (\(x::[a]) -> ...) is usually rejected.  This is
           more restrictive than before, and we might loosen up again.
      d)   A consequence of adding impredicativity is that GHC is a bit less
           gung ho about converting automatically between
        	(ty1 -> forall a. ty2)    and    (forall a. ty1 -> ty2)
           In particular, you may need to eta-expand some functions to make
           typechecking work again.
           Furthermore, functions are now invariant in their argument types,
           rather than being contravariant.  Again, the main consequence is
           that you may occasionally need to eta-expand function arguments when
           using higher-rank polymorphism.
      Please test, and let me know of any hiccups
      Scoped type variables in GHC
      	January 2006
      0) Terminology.
         A *pattern binding* is of the form
      	pat = rhs
         A *function binding* is of the form
      	f pat1 .. patn = rhs
         A binding of the formm
      	var = rhs
         is treated as a (degenerate) *function binding*.
         A *declaration type signature* is a separate type signature for a
         let-bound or where-bound variable:
      	f :: Int -> Int
         A *pattern type signature* is a signature in a pattern: 
      	\(x::a) -> x
      	f (x::a) = x
         A *result type signature* is a signature on the result of a
         function definition:
      	f :: forall a. [a] -> a
      	head (x:xs) :: a = x
         The form
      	x :: a = rhs
         is treated as a (degnerate) function binding with a result
         type signature, not as a pattern binding.
      1) The main invariants:
           A) A lexically-scoped type variable always names a (rigid)
       	type variable (not an arbitrary type).  THIS IS A CHANGE.
              Previously, a scoped type variable named an arbitrary *type*.
           B) A type signature always describes a rigid type (since
      	its free (scoped) type variables name rigid type variables).
      	This is also a change, a consequence of (A).
           C) Distinct lexically-scoped type variables name distinct
      	rigid type variables.  This choice is open; 
      2) Scoping
      2(a) If a declaration type signature has an explicit forall, those type
         variables are brought into scope in the right hand side of the 
         corresponding binding (plus, for function bindings, the patterns on
         the LHS).  
      	f :: forall a. a -> [a]
      	f (x::a) = [x :: a, x]
         Both occurences of 'a' in the second line are bound by 
         the 'forall a' in the first line
         A declaration type signature *without* an explicit top-level forall
         is implicitly quantified over all the type variables that are
         mentioned in the type but not already in scope.  GHC's current
         rule is that this implicit quantification does *not* bring into scope
         any new scoped type variables.
      	f :: a -> a
      	f x = ...('a' is not in scope here)...
         This gives compatibility with Haskell 98
      2(b) A pattern type signature implicitly brings into scope any type
         variables mentioned in the type that are not already into scope.
         These are called *pattern-bound type variables*.
      	g :: a -> a -> [a]
      	g (x::a) (y::a) = [y :: a, x]
         The pattern type signature (x::a) brings 'a' into scope.
         The 'a' in the pattern (y::a) is bound, as is the occurrence on 
         the RHS.  
         A pattern type siganture is the only way you can bring existentials 
         into scope.
      	data T where
      	  MkT :: forall a. a -> (a->Int) -> T
      	f x = case x of
      		MkT (x::a) f -> f (x::a)
      2a) QUESTION
      	class C a where
      	  op :: forall b. b->a->a
      	instance C (T p q) where
      	  op = <rhs>
          Clearly p,q are in scope in <rhs>, but is 'b'?  Not at the moment.
          Nor can you add a type signature for op in the instance decl.
          You'd have to say this:
      	instance C (T p q) where
      	  op = let op' :: forall b. ...
      	           op' = <rhs>
      	       in op'
      3) A pattern-bound type variable is allowed only if the pattern's
         expected type is rigid.  Otherwise we don't know exactly *which*
         skolem the scoped type variable should be bound to, and that means
         we can't do GADT refinement.  This is invariant (A), and it is a 
         big change from the current situation.
      	f (x::a) = x	-- NO; pattern type is wobbly
      	g1 :: b -> b
      	g1 (x::b) = x	-- YES, because the pattern type is rigid
      	g2 :: b -> b
      	g2 (x::c) = x	-- YES, same reason
      	h :: forall b. b -> b
      	h (x::b) = x	-- YES, but the inner b is bound
      	k :: forall b. b -> b
      	k (x::c) = x	-- NO, it can't be both b and c
      3a) You cannot give different names for the same type variable in the same scope
          (Invariant (C)):
      	f1 :: p -> p -> p		-- NO; because 'a' and 'b' would be
      	f1 (x::a) (y::b) = (x::a)	--     bound to the same type variable
      	f2 :: p -> p -> p		-- OK; 'a' is bound to the type variable
      	f2 (x::a) (y::a) = (x::a)	--     over which f2 is quantified
      					-- NB: 'p' is not lexically scoped
      	f3 :: forall p. p -> p -> p	-- NO: 'p' is now scoped, and is bound to
      	f3 (x::a) (y::a) = (x::a)	--     to the same type varialble as 'a'
      	f4 :: forall p. p -> p -> p	-- OK: 'p' is now scoped, and its occurences
      	f4 (x::p) (y::p) = (x::p)	--     in the patterns are bound by the forall
      3b) You can give a different name to the same type variable in different
          disjoint scopes, just as you can (if you want) give diferent names to 
          the same value parameter
      	g :: a -> Bool -> Maybe a
      	g (x::p) True  = Just x  :: Maybe p
      	g (y::q) False = Nothing :: Maybe q
      3c) Scoped type variables respect alpha renaming. For example, 
          function f2 from (3a) above could also be written:
      	f2' :: p -> p -> p
      	f2' (x::b) (y::b) = x::b
         where the scoped type variable is called 'b' instead of 'a'.
      4) Result type signatures obey the same rules as pattern types signatures.
         In particular, they can bind a type variable only if the result type is rigid
      	f x :: a = x	-- NO
      	g :: b -> b
      	g x :: b = x	-- YES; binds b in rhs
      5) A *pattern type signature* in a *pattern binding* cannot bind a 
         scoped type variable
      	(x::a, y) = ...		-- Legal only if 'a' is already in scope
         Reason: in type checking, the "expected type" of the LHS pattern is
         always wobbly, so we can't bind a rigid type variable.  (The exception
         would be for an existential type variable, but existentials are not
         allowed in pattern bindings either.)
         Even this is illegal
      	f :: forall a. a -> a
      	f x = let ((y::b)::a, z) = ... 
         Here it looks as if 'b' might get a rigid binding; but you can't bind
         it to the same skolem as a.
      6) Explicitly-forall'd type variables in the *declaration type signature(s)*
         for a *pattern binding* do not scope AT ALL.
      	x :: forall a. a->a	  -- NO; the forall a does 
      	Just (x::a->a) = Just id  --     not scope at all
      	y :: forall a. a->a
      	Just y = Just (id :: a->a)  -- NO; same reason
         THIS IS A CHANGE, but one I bet that very few people will notice.
         Here's why:
      	strange :: forall b. (b->b,b->b)
      	strange = (id,id)
      	x1 :: forall a. a->a
      	y1 :: forall b. b->b
      	(x1,y1) = strange
          This is legal Haskell 98 (modulo the forall). If both 'a' and 'b'
          both scoped over the RHS, they'd get unified and so cannot stand
          for distinct type variables. One could *imagine* allowing this:
      	x2 :: forall a. a->a
      	y2 :: forall a. a->a
      	(x2,y2) = strange
          using the very same type variable 'a' in both signatures, so that
          a single 'a' scopes over the RHS.  That seems defensible, but odd,
          because though there are two type signatures, they introduce just
          *one* scoped type variable, a.
      7) Possible extension.  We might consider allowing
      	\(x :: [ _ ]) -> <expr>
          where "_" is a wild card, to mean "x has type list of something", without
          naming the something.
  30. 19 Jul, 2005 1 commit
    • simonpj's avatar
      [project @ 2005-07-19 16:44:50 by simonpj] · a7ecdf96
      simonpj authored
      WARNING: this is a big commit.  You might want 
      	to wait a few days before updating, in case I've 
      	broken something.
      	However, if any of the changes are what you wanted,
      	please check it out and test!
      This commit does three main things:
      1. A re-organisation of the way that GHC handles bindings in HsSyn.
         This has been a bit of a mess for quite a while.  The key new
         types are
      	-- Bindings for a let or where clause
      	data HsLocalBinds id
      	  = HsValBinds (HsValBinds id)
      	  | HsIPBinds  (HsIPBinds id)
      	  | EmptyLocalBinds
      	-- Value bindings (not implicit parameters)
      	data HsValBinds id
      	  = ValBindsIn  -- Before typechecking
      		(LHsBinds id) [LSig id]	-- Not dependency analysed
      					-- Recursive by default
      	  | ValBindsOut	-- After typechecking
      		[(RecFlag, LHsBinds id)]-- Dependency analysed
      2. Implement Mark Jones's idea of increasing polymoprhism
         by using type signatures to cut the strongly-connected components
         of a recursive group.  As a consequence, GHC no longer insists
         on the contexts of the type signatures of a recursive group
         being identical.
         This drove a significant change: the renamer no longer does dependency
         analysis.  Instead, it attaches a free-variable set to each binding,
         so that the type checker can do the dep anal.  Reason: the typechecker
         needs to do *two* analyses:
      	one to find the true mutually-recursive groups
      		(which we need so we can build the right CoreSyn)
      	one to find the groups in which to typecheck, taking
      		account of type signatures
      3. Implement non-ground SPECIALISE pragmas, as promised, and as
         requested by Remi and Ross.  Certainly, this should fix the 
         current problem with GHC, namely that if you have
      	g :: Eq a => a -> b -> b
         then you can now specialise thus
      	SPECIALISE g :: Int -> b -> b
          (This didn't use to work.)
         However, it goes further than that.  For example:
      	f :: (Eq a, Ix b) => a -> b -> b
         then you can make a partial specialisation
      	SPECIALISE f :: (Eq a) => a -> Int -> Int
          In principle, you can specialise f to *any* type that is
          "less polymorphic" (in the sense of subsumption) than f's 
          actual type.  Such as
      	SPECIALISE f :: Eq a => [a] -> Int -> Int
          But I haven't tested that.
          I implemented this by doing the specialisation in the typechecker
          and desugarer, rather than leaving around the strange SpecPragmaIds,
          for the specialiser to find.  Indeed, SpecPragmaIds have vanished 
          altogether (hooray).
          Pragmas in general are handled more tidily.  There's a new
          data type HsBinds.Prag, which lives in an AbsBinds, and carries
          pragma info from the typechecker to the desugarer.
      Smaller things
      - The loop in the renamer goes via RnExpr, instead of RnSource.
        (That makes it more like the type checker.)
      - I fixed the thing that was causing 'check_tc' warnings to be 
  31. 04 May, 2005 1 commit
    • ross's avatar
      [project @ 2005-05-04 10:28:07 by ross] · 00007e64
      ross authored
      Another go at the handling of -< in arrow notation, continuing and
      fixing the changes in
      Now do the same thing in the renamer as we do in the type checker,
      i.e. return to the environment of the proc when considering the left
      argument of -<.
      This is much simpler than the old proc_level stuff, and matches the
      type rules more clearly.  But there is a change in error messages.
      For the input
      	f :: Int -> Int
      	f = proc x -> (+x) -< 1
      GHC 6.4 says
      	    Command-bound variable `x' is not in scope here
      		Reason: it is used in the left argument of (-<)
      	    In the second argument of `(+)', namely `x'
      	    In the command: (+ x) -< 1
      	    In the definition of `f': f = proc x -> (+ x) -< 1
      but now we just get the blunt
      	test.hs:6:16: Not in scope: `x'
      The beauty is all on the inside.
      Similarly leakage of existential type variables (arrow1) is detected,
      but the error message isn't very helpful.
  32. 16 Apr, 2005 1 commit
    • ross's avatar
      [project @ 2005-04-16 16:05:52 by ross] · 872f7e82
      ross authored
      Rejig handling of environments in arrow notation: instead of the
      proc_level stuff, we just record the environment of the proc, and
      use that on the left side of -< and the head of (|...|).
      This also makes the arrow1 test yield a compile error, as it should,
      but the error message is uninformative.
  33. 04 Apr, 2005 1 commit
    • simonpj's avatar
      [project @ 2005-04-04 11:55:11 by simonpj] · d551dbfe
      simonpj authored
      This commit combines three overlapping things:
      1.  Make rebindable syntax work for do-notation. The idea
          here is that, in particular, (>>=) can have a type that
          has class constraints on its argument types, e.g.
             (>>=) :: (Foo m, Baz a) => m a -> (a -> m b) -> m b
          The consequence is that a BindStmt and ExprStmt must have
          individual evidence attached -- previously it was one
          batch of evidence for the entire Do
          Sadly, we can't do this for MDo, because we use bind at
          a polymorphic type (to tie the knot), so we still use one
          blob of evidence (now in the HsStmtContext) for MDo.
          For arrow syntax, the evidence is in the HsCmd.
          For list comprehensions, it's all built-in anyway.
          So the evidence on a BindStmt is only used for ordinary
      2.  Tidy up HsSyn.  In particular:
      	- Eliminate a few "Out" forms, which we can manage
      	without (e.g. 
      	- It ought to be the case that the type checker only
      	decorates the syntax tree, but doesn't change one
      	construct into another.  That wasn't true for NPat,
      	LitPat, NPlusKPat, so I've fixed that.
      	- Eliminate ResultStmts from Stmt.  They always had
      	to be the last Stmt, which led to awkward pattern
      	matching in some places; and the benefits didn't seem
      	to outweigh the costs.  Now each construct that uses
      	[Stmt] has a result expression too (e.g. GRHS).
      3.  Make 'deriving( Ix )' generate a binding for unsafeIndex,
          rather than for index.  This is loads more efficient.
          (This item only affects TcGenDeriv, but some of point (2)
          also affects TcGenDeriv, so it has to be in one commit.)
  34. 31 Mar, 2005 1 commit
    • simonmar's avatar
      [project @ 2005-03-31 10:16:33 by simonmar] · 853e20a3
      simonmar authored
      Tweaks to get the GHC sources through Haddock.  Doesn't quite work
      yet, because Haddock complains about the recursive modules.  Haddock
      needs to understand SOURCE imports (it can probably just ignore them
      as a first attempt).
  35. 15 Mar, 2005 1 commit
    • ross's avatar
      [project @ 2005-03-15 11:59:32 by ross] · 1dfb756e
      ross authored
      Fix (and test) for SourceForge bug 1161624: erroneous rejection of
      	foo = proc x -> arr (\y -> y-1) -< x
      Now open a new level for the left side of -<, so that variables bound
      in the proc are illegal, but variables bound in the expression are OK.
      Note that the levels gimmick doesn't really implement holes in the
      scope: it rules out nasty obfuscations like
      	foo x = proc x -> arr (\y -> x-1) -< x
      Also added the same treatment to the head of a `form', where it was
      (for STABLE)
  36. 22 Dec, 2004 1 commit
    • simonpj's avatar
      [project @ 2004-12-22 16:58:34 by simonpj] · 20e39e0e
      simonpj authored
      	     Add more scoped type variables
      Now the top-level forall'd variables of a type signature scope
      over the right hand side of that function.
      	f :: a -> a
      	f x = ....
      The type variable 'a' is in scope in the RHS, and in f's patterns.
      It's implied by -fglasgow-exts, but can also be switched off independently
      using -fscoped-type-variables (and the -fno variant)
  37. 30 Sep, 2004 1 commit
    • simonpj's avatar
      [project @ 2004-09-30 10:35:15 by simonpj] · 23f40f0e
      simonpj authored
      	Add Generalised Algebraic Data Types
      This rather big commit adds support for GADTs.  For example,
          data Term a where
       	  Lit :: Int -> Term Int
      	  App :: Term (a->b) -> Term a -> Term b
      	  If  :: Term Bool -> Term a -> Term a
          eval :: Term a -> a
          eval (Lit i) = i
          eval (App a b) = eval a (eval b)
          eval (If p q r) | eval p    = eval q
          		    | otherwise = eval r
      Lots and lots of of related changes throughout the compiler to make
      this fit nicely.
      One important change, only loosely related to GADTs, is that skolem
      constants in the typechecker are genuinely immutable and constant, so
      we often get better error messages from the type checker.  See
      There's a new module types/Unify.lhs, which has purely-functional
      unification and matching for Type. This is used both in the typechecker
      (for type refinement of GADTs) and in Core Lint (also for type refinement).
  38. 15 Sep, 2004 1 commit
    • ross's avatar
      [project @ 2004-09-15 17:48:08 by ross] · daf67985
      ross authored
      arrow notation: allow arrow applications (f -< a) to take a non-empty
      command stack, as suggested by Sebastian Boldt <Sebastian.Boldt@arcor.de>.
  39. 12 Jan, 2004 1 commit