1. 03 Jan, 2012 1 commit
    • Simon Peyton Jones's avatar
      Major refactoring of CoAxioms · 98a642cf
      Simon Peyton Jones authored
      This patch should have no user-visible effect.  It implements a
      significant internal refactoring of the way that FC axioms are
      handled.  The ultimate goal is to put us in a position to implement
      "pattern-matching axioms".  But the changes here are only does
      refactoring; there is no change in functionality.
      
      Specifically:
      
       * We now treat data/type family instance declarations very,
         very similarly to types class instance declarations:
      
         - Renamed InstEnv.Instance as InstEnv.ClsInst, for symmetry with
           FamInstEnv.FamInst.  This change does affect the GHC API, but
           for the better I think.
      
         - Previously, each family type/data instance declaration gave rise
           to a *TyCon*; typechecking a type/data instance decl produced
           that TyCon.  Now, each type/data instance gives rise to
           a *FamInst*, by direct analogy with each class instance
           declaration giving rise to a ClsInst.
      
         - Just as each ClsInst contains its evidence, a DFunId, so each FamInst
           contains its evidence, a CoAxiom.  See Note [FamInsts and CoAxioms]
           in FamInstEnv.  The CoAxiom is a System-FC thing, and can relate any
           two types, whereas the FamInst relates directly to the Haskell source
           language construct, and always has a function (F tys) on the LHS.
      
         - Just as a DFunId has its own declaration in an interface file, so now
           do CoAxioms (see IfaceSyn.IfaceAxiom).
      
         These changes give rise to almost all the refactoring.
      
       * We used to have a hack whereby a type family instance produced a dummy
         type synonym, thus
            type instance F Int = Bool -> Bool
         translated to
            axiom FInt :: F Int ~ R:FInt
            type R:FInt = Bool -> Bool
         This was always a hack, and now it's gone.  Instead the type instance
         declaration produces a FamInst, whose axiom has kind
            axiom FInt :: F Int ~ Bool -> Bool
         just as you'd expect.
      
       * Newtypes are done just as before; they generate a CoAxiom. These
         CoAxioms are "implicit" (do not generate an IfaceAxiom declaration),
         unlike the ones coming from family instance declarations.  See
         Note [Implicit axioms] in TyCon
      
      On the whole the code gets significantly nicer.  There were consequential
      tidy-ups in the vectoriser, but I think I got them right.
      98a642cf
  2. 19 Dec, 2011 1 commit
    • Simon Peyton Jones's avatar
      Tidy up pretty-printing for variables · c492e50b
      Simon Peyton Jones authored
      We already have a class OutputableBndr; this patch adds
      methods pprInfixOcc and pprPrefixOcc, so that we can get
      rid of the hideous hack (the old) Outputable.pprHsVar.
      
      The hack was exposed by Trac #5657, which is thereby fixed.
      c492e50b
  3. 25 Nov, 2011 1 commit
  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. 31 Oct, 2011 2 commits
  6. 10 Oct, 2011 1 commit
  7. 01 Oct, 2011 1 commit
  8. 29 Sep, 2011 1 commit
  9. 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
  10. 01 Sep, 2011 1 commit
    • Simon Peyton Jones's avatar
      Allow associated types to have fresh parameters · d2d6bdae
      Simon Peyton Jones authored
      This patch allows
      
           class C a where
             type T a b :: *
           instance C Int
             type T Int b = b -> b
      
      That is, T has a type index 'b' that is not one of the class
      variables.
      
      On the way I did a good deal of refactoring (as usual), especially in
      TcInstDcls.tcLocalInstDecl1, which checks for consistent instantiation
      of the class instance and the type instance.  Less code, more
      expressiveness.  See Note [Checking consistent instantiation]
      d2d6bdae
  11. 24 Aug, 2011 1 commit
  12. 23 Aug, 2011 1 commit
  13. 22 Aug, 2011 1 commit
  14. 18 Aug, 2011 2 commits
  15. 20 Jul, 2011 1 commit
  16. 13 Jun, 2011 1 commit
  17. 29 Apr, 2011 1 commit
  18. 26 Apr, 2011 1 commit
  19. 20 Feb, 2011 1 commit
    • chak@cse.unsw.edu.au.'s avatar
      Added a VECTORISE pragma · f2aaae97
      chak@cse.unsw.edu.au. authored
      - Added a pragma {-# VECTORISE var = exp #-} that prevents
        the vectoriser from vectorising the definition of 'var'.
        Instead it uses the binding '$v_var = exp' to vectorise
        'var'.  The vectoriser checks that the Core type of 'exp'
        matches the vectorised Core type of 'var'.  (It would be
        quite complicated to perform that check in the type checker
        as the vectorisation of a type needs the state of the VM
        monad.)
      - Added parts of a related VECTORISE SCALAR pragma
      - Documented -ddump-vect
      - Added -ddump-vt-trace
      - Some clean up
      f2aaae97
  20. 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
  21. 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
  22. 13 Sep, 2010 1 commit
  23. 15 Jun, 2010 1 commit
  24. 06 May, 2010 2 commits
    • simonpj@microsoft.com's avatar
      Refactoring of hsXxxBinders · 241c6ba5
      simonpj@microsoft.com authored
      This patch moves various functions that extract the binders
      from a HsTyClDecl, HsForeignDecl etc into HsUtils, and gives
      them consistent names.
      241c6ba5
    • simonpj@microsoft.com's avatar
      Add a HsExplicitFlag to SpliceDecl, to improve Trac #4042 · 302e2e29
      simonpj@microsoft.com authored
      The issue here is that 
      
          g :: A -> A
          f
          data A = A
      
      is treated as if you'd written $(f); that is the call of
      f is a top-level Template Haskell splice.  This patch 
      makes sure that we *first* check the -XTemplateHaskellFlag
      and bleat about a parse error if it's off.  Othewise we
      get strange seeing "A is out of scope" errors.
      302e2e29
  25. 30 Mar, 2010 1 commit
  26. 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
  27. 04 Jan, 2010 1 commit
  28. 02 Jan, 2010 1 commit
  29. 29 Oct, 2009 1 commit
  30. 26 Aug, 2009 1 commit
  31. 25 Aug, 2009 1 commit
  32. 27 Jul, 2009 1 commit
  33. 02 Jul, 2009 1 commit
    • simonpj@microsoft.com's avatar
      New syntax for GADT-style record declarations, and associated refactoring · 432b9c93
      simonpj@microsoft.com authored
      The main purpose of this patch is to fix Trac #3306, by fleshing out the
      syntax for GADT-style record declraations so that you have a context in 
      the type.  The new form is
         data T a where
           MkT :: forall a. Eq a => { x,y :: !a } -> T a
      See discussion on the Trac ticket.
      
      The old form is still allowed, but give a deprecation warning.
      
      When we remove the old form we'll also get rid of the one reduce/reduce
      error in the grammar. Hurrah!
      
      While I was at it, I failed as usual to resist the temptation to do lots of
      refactoring.  The parsing of data/type declarations is now much simpler and
      more uniform.  Less code, less chance of errors, and more functionality.
      Took longer than I planned, though.
      
      ConDecl has record syntax, but it was not being used consistently, so I
      pushed that through the compiler.
      432b9c93
  34. 26 Jun, 2009 1 commit
  35. 27 May, 2009 1 commit
  36. 19 Mar, 2009 1 commit