1. 17 Oct, 2011 2 commits
  2. 14 Oct, 2011 2 commits
  3. 13 Oct, 2011 1 commit
  4. 11 Oct, 2011 1 commit
  5. 10 Oct, 2011 1 commit
  6. 06 Oct, 2011 3 commits
  7. 05 Oct, 2011 1 commit
  8. 02 Oct, 2011 1 commit
  9. 27 Sep, 2011 2 commits
  10. 23 Sep, 2011 4 commits
    • Simon Peyton Jones's avatar
      Make a new type synonym CoreProgram = [CoreBind] · 488e21c8
      Simon Peyton Jones authored
      and comment its invariants in Note [CoreProgram] in CoreSyn
      
      I'm not totally convinced that CoreProgram is the right name
      (perhaps CoreTopBinds might better), but it is useful to have
      a clue that you are looking at the top-level bindings.
      
      This is only a matter of a type synonym change; no deep
      refactoring here.
      488e21c8
    • Simon Peyton Jones's avatar
      Implement GHCi command :kind! which normalises its type · f3c7ed72
      Simon Peyton Jones authored
         type family F a
         type instance F Int = Bool
         type instance F Bool = Char
      
      In GHCi
         *TF> :kind (F Int, F Bool)
         (F Int, F Bool) :: *
         *TF> :kind! F Int
         (F Int, F Bool) :: *
         = (Bool, Char)
      
      We could call it ":normalise" but it seemed quite nice to have an
      eager version of :kind
      f3c7ed72
    • Simon Peyton Jones's avatar
      Add a transformation limit to the simplifier (Trac #5448) · 24a2353a
      Simon Peyton Jones authored
      This addresses the rare cases where the simplifier diverges
      (see the above ticket).  We were already counting how many simplifier
      steps were taking place, but with no limit.  This patch adds a limit;
      at which point we halt compilation, and print out useful stats. The
      stats show what is begin inlined, and how often, which points you
      directly to the problem.  The limit is set based on the size of the
      program.
      
      Instead of halting compilation, we could instead just inhibit
      inlining, which would let compilation of the module complete. This is
      a bit harder to implement, and it's likely to mean that you unrolled
      the function 1143 times and then ran out of ticks; you probably don't
      want to complete parsing on this highly-unrolled program.
      
      Flags: -dsimpl-tick-factor=N.  Default is 100 (percent).
             A bigger number increases the allowed maximum tick count.
      24a2353a
    • Simon Peyton Jones's avatar
      Take account of the mk_integer in a LitInteger when computing CAF-hood · 730f6c6e
      Simon Peyton Jones authored
      This is a follow-on to Ian's Integer-literal patch.
      In effect the mk_integer Id is a free variable of a LitInteger literal.
      
      I've also added some comments (Note [Integer literals]) in Literal.
      730f6c6e
  11. 21 Sep, 2011 3 commits
    • Simon Marlow's avatar
      fix warnings · 01d7bc77
      Simon Marlow authored
      01d7bc77
    • Simon Marlow's avatar
      94e7c6bf
    • Simon Marlow's avatar
      Add support for all top-level declarations to GHCi · 3db75724
      Simon Marlow authored
        This is work mostly done by Daniel Winograd-Cort during his
        internship at MSR Cambridge, with some further refactoring by me.
      
      This commit adds support to GHCi for most top-level declarations that
      can be used in Haskell source files.  Class, data, newtype, type,
      instance are all supported, as are Type Family-related declarations.
      
      The current set of declarations are shown by :show bindings.  As with
      variable bindings, entities bound by newer declarations shadow earlier
      ones.
      
      Tests are in testsuite/tests/ghci/scripts/ghci039--ghci054.
      Documentation to follow.
      3db75724
  12. 15 Sep, 2011 1 commit
  13. 07 Sep, 2011 1 commit
  14. 06 Sep, 2011 1 commit
    • batterseapower's avatar
      Implement -XConstraintKind · 9729fe7c
      batterseapower authored
      Basically as documented in http://hackage.haskell.org/trac/ghc/wiki/KindFact,
      this patch adds a new kind Constraint such that:
      
        Show :: * -> Constraint
        (?x::Int) :: Constraint
        (Int ~ a) :: Constraint
      
      And you can write *any* type with kind Constraint to the left of (=>):
      even if that type is a type synonym, type variable, indexed type or so on.
      
      The following (somewhat related) changes are also made:
       1. We now box equality evidence. This is required because we want
          to give (Int ~ a) the *lifted* kind Constraint
       2. For similar reasons, implicit parameters can now only be of
          a lifted kind. (?x::Int#) => ty is now ruled out
       3. Implicit parameter constraints are now allowed in superclasses
          and instance contexts (this just falls out as OK with the new
          constraint solver)
      
      Internally the following major changes were made:
       1. There is now no PredTy in the Type data type. Instead
          GHC checks the kind of a type to figure out if it is a predicate
       2. There is now no AClass TyThing: we represent classes as TyThings
          just as a ATyCon (classes had TyCons anyway)
       3. What used to be (~) is now pretty-printed as (~#). The box
          constructor EqBox :: (a ~# b) -> (a ~ b)
       4. The type LCoercion is used internally in the constraint solver
          and type checker to represent coercions with free variables
          of type (a ~ b) rather than (a ~# b)
      9729fe7c
  15. 02 Sep, 2011 1 commit
    • Simon Peyton Jones's avatar
      Some minor wibbling in printing source locations · 0ccf2c3b
      Simon Peyton Jones authored
      I found that an imported instance was getting printed with <no
      location info>.  Fixing this pushed me into a bit more refactoring
      than I intended, but it's all small aesthetic stuff, nothing
      fundamental.  Caused some error message to change as a result.
      
      I removed pprDefnLoc from the GHC API because it doesn't seem to be
      used.  Name.pprNamedefnLoc and pprDefinedAt are probably more useful
      anyway.
      0ccf2c3b
  16. 01 Sep, 2011 1 commit
  17. 26 Aug, 2011 1 commit
  18. 25 Aug, 2011 3 commits
  19. 24 Aug, 2011 1 commit
  20. 23 Aug, 2011 1 commit
  21. 22 Aug, 2011 1 commit
  22. 21 Aug, 2011 1 commit
  23. 18 Aug, 2011 1 commit
  24. 16 Aug, 2011 2 commits
    • tibbe's avatar
      Add popCnt# primop · 2d0438f3
      tibbe authored
      2d0438f3
    • Simon Peyton Jones's avatar
      Major improvement to pattern bindings · 49dbe605
      Simon Peyton Jones authored
      This patch makes a number of related improvements
      
      a) Implements the Haskell Prime semantics for pattern bindings
         (Trac #2357).  That is, a pattern binding p = e is typed
         just as if it had been written
              t = e
              f = case t of p -> f
              g = case t of p -> g
              ... etc ...
         where f,g are the variables bound by p. In paricular it's
         ok to say
            (f,g) = (\x -> x, \y -> True)
         and f and g will get propertly inferred types
            f :: a -> a
            g :: a -> Int
      
      b) Eliminates the MonoPatBinds flag altogether.  (For the moment
         it is deprecated and has no effect.)  Pattern bindings are now
         generalised as per (a).  Fixes Trac #2187 and #4940, in the
         way the users wanted!
      
      c) Improves the OutsideIn algorithm generalisation decision.
         Given a definition without a type signature (implying "infer
         the type"), the published algorithm rule is this:
            - generalise *top-level* functions, and
            - do not generalise *nested* functions
         The new rule is
            - generalise a binding whose free variables have
              Guaranteed Closed Types
            - do not generalise other bindings
      
         Generally, a top-level let-bound function has a Guaranteed
         Closed Type, and so does a nested function whose free vaiables
         are top-level functions, and so on. (However a top-level
         function that is bitten by the Monomorphism Restriction does
         not have a GCT.)
      
         Example:
           f x = let { foo y = y } in ...
         Here 'foo' has no free variables, so it is generalised despite
         being nested.
      
      d) When inferring a type f :: ty for a definition f = e, check that
         the compiler would accept f :: ty as a type signature for that
         same definition.  The type is rejected precisely when the type
         is ambiguous.
      
         Example:
            class Wob a b where
              to :: a -> b
              from :: b -> a
      
            foo x = [x, to (from x)]
         GHC 7.0 would infer the ambiguous type
            foo :: forall a b. Wob a b => b -> [b]
         but that type would give an error whenever it is called; and
         GHC 7.0 would reject that signature if given by the
         programmer.  The new type checker rejects it up front.
      
         Similarly, with the advent of type families, ambiguous types are
         easy to write by mistake.  See Trac #1897 and linked tickets for
         many examples.  Eg
            type family F a :: *
            f ::: F a -> Int
            f x = 3
         This is rejected because (F a ~ F b) does not imply a~b.  Previously
         GHC would *infer* the above type for f, but was unable to check it.
         Now even the inferred type is rejected -- correctly.
      
      The main implemenation mechanism is to generalise the abe_wrap
      field of ABExport (in HsBinds), from [TyVar] to HsWrapper. This
      beautiful generalisation turned out to make everything work nicely
      with minimal programming effort.  All the work was fiddling around
      the edges; the core change was easy!
      49dbe605
  25. 10 Aug, 2011 2 commits
  26. 09 Aug, 2011 1 commit
    • Simon Peyton Jones's avatar
      Make the free variable finder in TidyPgm work properly · 349b8bb2
      Simon Peyton Jones authored
      We were getting exponential behaviour by gathering free
      variables *both* from the unfolding *and* the RHS of
      a definition.  While unfoldings are of limited size this
      is merely inefficient.  But with -fexpose-all-unfoldings
      it becomes exponentially costly. Doh.
      
      Fixes Trac #5352.
      349b8bb2