1. 06 Feb, 2012 1 commit
    • Simon Peyton Jones's avatar
      Refactor HsDecls again, to put family instances in InstDecl · f92591de
      Simon Peyton Jones authored
      This continues the clean up of the front end.  Since they
      were first invented, type and data family *instance* decls
      have been in the TyClDecl data type, even though they always
      treated separately.
      
      This patch takes a step in the right direction
        * The InstDecl type now includes both class instances and
          type/data family instances
      
        * The hs_tyclds field of HsGroup now never has any family
          instance declarations in it
      
      However a family instance is still a TyClDecl.  It should really
      be a separate type, but that's the next step.
      
      All this was provoked by fixing Trac #5792 in the HEAD.
      (I did a less invasive fix on the branch.)
      f92591de
  2. 17 Nov, 2011 1 commit
  3. 16 Nov, 2011 1 commit
    • dreixel's avatar
      Changes to the kind checker · e589a49d
      dreixel authored
      We now always check against an expected kind. When we really don't know what
      kind to expect, we match against a new meta kind variable.
      
      Also, we are more explicit about tuple sorts:
        HsUnboxedTuple                  -> Produced by the parser
        HsBoxedTuple                    -> Certainly a boxed tuple
        HsConstraintTuple               -> Certainly a constraint tuple
        HsBoxedOrConstraintTuple        -> Could be a boxed or a constraint
                                        tuple. Produced by the parser only,
                                        disappears after type checking
      e589a49d
  4. 11 Nov, 2011 1 commit
    • dreixel's avatar
      New kind-polymorphic core · 09015be8
      dreixel authored
      This big patch implements a kind-polymorphic core for GHC. The current
      implementation focuses on making sure that all kind-monomorphic programs still
      work in the new core; it is not yet guaranteed that kind-polymorphic programs
      (using the new -XPolyKinds flag) will work.
      
      For more information, see http://haskell.org/haskellwiki/GHC/Kinds
      09015be8
  5. 04 Nov, 2011 1 commit
  6. 01 Oct, 2011 1 commit
  7. 09 Sep, 2011 1 commit
    • batterseapower's avatar
      Implement associated type defaults · de8c8d68
      batterseapower authored
      Basically, now you can write:
      
        class Cls a where
          type Typ a
          type Typ a = Just a
      
      And now if an instance does not specify an explicit associated type
      instance, one will be generated afresh based on that default. So for
      example this instance:
      
        instance Cls Int where
      
      Will be equivalent to this one:
      
        instance Cls Int where
          type Typ Int = Just Int
      de8c8d68
  8. 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
  9. 22 Aug, 2011 1 commit
    • Simon Peyton Jones's avatar
      A batch of changes related to the handling of binders in instance decls · f76f0d0e
      Simon Peyton Jones authored
      The issue is that in
          instnace C T where
            data S = ...
            f = ...
      neither S nor f is really a binder; they are *occurrences*.  Moreover
      Haskell dictates that these particular occurrences are disambiguated
      by looking at the class whose instance they occur in.
      
      Some of this was not handled right for associated types.  And
      RnNames.getLocalNonValBinders was a bit messhy; this patch tidies it
      up.
      
      (And thenM is finally gone from RnSource.)
      f76f0d0e
  10. 15 Aug, 2011 1 commit
  11. 05 Aug, 2011 1 commit
  12. 15 Jul, 2011 1 commit
  13. 13 Jul, 2011 1 commit
  14. 11 Jun, 2011 1 commit
    • Simon Peyton Jones's avatar
      Make TH capable of quoting GADT declarations (Trac #5217) · 5c4a4c4b
      Simon Peyton Jones authored
      Template Haskell doesn't support GADTs directly but
      we can use equality constraints to do the job. Here's
      an example of the dump from splicing such a declaration:
      
          [d| data T a b
                  where
                    T1 :: Int -> T Int Char
                    T2 :: a -> T a a
                    T3 :: a -> T [a] a
                    T4 :: a -> b -> T b [a] |]
        ======>
          T5217.hs:(6,3)-(9,53)
          data T a[aQW] b[aQX]
              = (b[aQX] ~ Char, a[aQW] ~ Int) => T1 Int |
                b[aQX] ~ a[aQW] => T2 a[aQW] |
                a[aQW] ~ [b[aQX]] => T3 b[aQX] |
                forall a[aQY]. b[aQX] ~ [a[aQY]] => T4 a[aQY] a[aQW]
      5c4a4c4b
  15. 10 Jun, 2011 2 commits
  16. 15 May, 2011 2 commits
  17. 04 May, 2011 1 commit
    • dreixel's avatar
      Remove HsNumTy and TypePati. · fed25228
      dreixel authored
      They belonged to the old generic deriving mechanism, so they can go. Adapted a lot of code as a consequence.
      fed25228
  18. 02 May, 2011 1 commit
  19. 28 Apr, 2011 1 commit
  20. 12 Apr, 2011 1 commit
  21. 29 Mar, 2011 1 commit
    • Ian Lynagh's avatar
      Renumber TH uniques · b5a358ee
      Ian Lynagh authored
      This fixes a couple of duplicates that had crept in, and also
      renumbers everything so that they are monotonically increasing
      through the file.
      b5a358ee
  22. 28 Mar, 2011 1 commit
  23. 17 Mar, 2011 1 commit
  24. 10 Feb, 2011 1 commit
  25. 10 Jan, 2011 1 commit
    • simonpj@microsoft.com's avatar
      Do dependency analysis when kind-checking type declarations · 6ea06bbf
      simonpj@microsoft.com authored
      This patch fixes Trac #4875.  The main point is to do dependency
      analysis on type and class declarations, and kind-check them in
      dependency order, so as to improve error messages.
      
      This patch means that a few programs that would typecheck before won't
      typecheck any more; but before we were (naughtily) going beyond
      Haskell 98 without any language-extension flags, and Trac #4875
      convinces me that doing so is a Bad Idea.
      
      Here's an example that won't typecheck any more
             data T a b = MkT (a b)
             type F k = T k Maybe
      
      If you look at T on its own you'd default 'a' to kind *->*;
      and then kind-checking would fail on F.
      
      But GHC currently accepts this program beause it looks at
      the *occurrences* of T.
      6ea06bbf
  26. 10 Dec, 2010 1 commit
  27. 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
      4e0c994e
  28. 10 Oct, 2010 1 commit
  29. 19 Sep, 2010 1 commit
    • Edward Z. Yang's avatar
      Interruptible FFI calls with pthread_kill and CancelSynchronousIO. v4 · 83d563cb
      Edward Z. Yang authored
      This is patch that adds support for interruptible FFI calls in the form
      of a new foreign import keyword 'interruptible', which can be used
      instead of 'safe' or 'unsafe'.  Interruptible FFI calls act like safe
      FFI calls, except that the worker thread they run on may be interrupted.
      
      Internally, it replaces BlockedOnCCall_NoUnblockEx with
      BlockedOnCCall_Interruptible, and changes the behavior of the RTS
      to not modify the TSO_ flags on the event of an FFI call from
      a thread that was interruptible.  It also modifies the bytecode
      format for foreign call, adding an extra Word16 to indicate
      interruptibility.
      
      The semantics of interruption vary from platform to platform, but the
      intent is that any blocking system calls are aborted with an error code.
      This is most useful for making function calls to system library
      functions that support interrupting.  There is no support for pre-Vista
      Windows.
      
      There is a partner testsuite patch which adds several tests for this
      functionality.
      83d563cb
  30. 15 Sep, 2010 1 commit
  31. 06 Sep, 2010 1 commit
  32. 06 May, 2010 1 commit
  33. 17 Mar, 2010 1 commit
  34. 04 Mar, 2010 1 commit
    • simonpj@microsoft.com's avatar
      Refactor part of the renamer to fix Trac #3901 · f1cc3eb9
      simonpj@microsoft.com authored
      This one was bigger than I anticipated!  The problem was that were
      were gathering the binders from a pattern before renaming -- but with
      record wild-cards we don't know what variables are bound by C {..}
      until after the renamer has filled in the "..".
      
      So this patch does the following
      
      * Change all the collect-X-Binders functions in HsUtils so that
        they expect to only be called *after* renaming.  That means they
        don't need to return [Located id] but just [id].  Which turned out
        to be a very worthwhile simplification all by itself.
      
      * Refactor the renamer, and in ptic RnExpr.rnStmt, so that it
        doesn't need to use collectLStmtsBinders on pre-renamed Stmts.
      
      * This in turn required me to understand how GroupStmt and
        TransformStmts were renamed.  Quite fiddly. I rewrote most of it;
        result is much shorter.
      
      * In doing so I flattened HsExpr.GroupByClause into its parent
        GroupStmt, with trivial knock-on effects in other files.
      
      Blargh.
      f1cc3eb9
  35. 10 Feb, 2010 2 commits
    • simonpj@microsoft.com's avatar
      Keep track of explicit kinding in HsTyVarBndr; plus fix Trac #3845 · 836b1e90
      simonpj@microsoft.com authored
      To print HsTypes correctly we should remember whether the Kind on
      a HsTyVarBndr came from type inference, or was put there by the
      user.  See Note [Printing KindedTyVars] in HsTypes.  So instead of
      changing a UserTyVar to a KindedTyVar during kind checking, we
      simply add a PostTcKind to the UserTyVar.
      
      The change was provoked by Trac #3830, although other changes
      mean that #3830 gets a diferent and better error message now.
      So this patch is simply doing the Right Thing for the future.
      
      This patch also fixes Trac #3845, which was caused by a *type splice*
      not remembering the free *term variables* mentioned in it.  Result
      was that we build a 'let' when it should have been 'letrec'.
      Hence a new FreeVars field in HsSpliceTy.
      
      While I was at it, I got rid of HsSpliceTyOut and use a PostTcKind
      on HsSpliceTy instead, just like on the UserTyVar.
      836b1e90
    • simonpj@microsoft.com's avatar
      Several TH/quasiquote changes · 6f8ff0bb
      simonpj@microsoft.com authored
      a) Added quasi-quote forms for
            declarations
            types
         e.g.   f :: [$qq| ... |]
      
      b) Allow Template Haskell pattern quotes (but not splices)
         e.g.  f x = [p| Int -> $x |]
      
      c) Improve pretty-printing for HsPat to remove superfluous
         parens.  (This isn't TH related really, but it affects
         some of the same code.)
      
      
      A consequence of (a) is that when gathering and grouping declarations
      in RnSource.findSplice, we must expand quasiquotes as we do so.
      Otherwise it's all fairly straightforward.  I did a little bit of
      refactoring in TcSplice.
      
      User-manual changes still to come.
      6f8ff0bb
  36. 20 Jan, 2010 1 commit
    • simonpj@microsoft.com's avatar
      Fix Trac #3813: unused variables in GHCi bindings · 85f969a6
      simonpj@microsoft.com authored
      In a GHCi stmt we don't want to report unused variables, 
      because we don't know the scope of the binding, eg
      
      	Prelude> x <- blah
      
      Fixing this needed a little more info about the context of the stmt,
      thus the new constructor GhciStmt in the HsStmtContext type.
      85f969a6
  37. 04 Jan, 2010 1 commit