1. 13 Jun, 2011 1 commit
  2. 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
  3. 26 Apr, 2011 1 commit
  4. 12 Apr, 2011 1 commit
  5. 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
  6. 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
  7. 07 Oct, 2010 1 commit
    • simonpj@microsoft.com's avatar
      Implement auto-specialisation of imported Ids · 92267aa2
      simonpj@microsoft.com authored
      This big-ish patch arranges that if an Id 'f' is 
        * Type-class overloaded 
             f :: Ord a => [a] -> [a]
        * Defined with an INLINABLE pragma
             {-# INLINABLE f #-}
        * Exported from its defining module 'D'
      
      then in any module 'U' that imports D
      
      1. Any call of 'f' at a fixed type will generate 
         (a) a specialised version of f in U
         (b) a RULE that rewrites unspecialised calls to the
             specialised on
      
        e.g. if the call is (f Int dOrdInt xs) then the 
        specialiser will generate
           $sfInt :: [Int] -> [Int]
           $sfInt = <code for f, imported from D, specialised>
           {-# RULE forall d.  f Int d = $sfInt #-}
      
      2. In addition, you can give an explicit {-# SPECIALISE -#}
         pragma for the imported Id
           {-# SPECIALISE f :: [Bool] -> [Bool] #-}
         This too generates a local specialised definition, 
         and the corresponding RULE 
      
      The new RULES are exported from module 'U', so that any module
      importing U will see the specialised versions of 'f', and will
      not re-specialise them.
      
      There's a flag -fwarn-auto-orphan that warns you if the auto-generated
      RULES are orphan rules. It's not in -Wall, mainly to avoid lots of
      error messages with existing packages.
      
      Main implementation changes
      
       - A new flag on a CoreRule to say if it was auto-generated.
         This is persisted across interface files, so there's a small
         change in interface file format.
      
       - Quite a bit of fiddling with plumbing, to get the 
         {-# SPECIALISE #-} pragmas for imported Ids.  In particular, a
         new field tgc_imp_specs in TcGblEnv, to keep the specialise
         pragmas for imported Ids between the typechecker and the desugarer.
      
       - Some new code (although surprisingly little) in Specialise,
         to deal with calls of imported Ids
      92267aa2
  8. 23 Sep, 2010 1 commit
  9. 18 Sep, 2010 1 commit
  10. 13 Sep, 2010 1 commit
  11. 24 Jul, 2010 1 commit
  12. 06 May, 2010 3 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
      Make tcg_dus behave more sanely; fixes a mkUsageInfo panic · b2d9ef84
      simonpj@microsoft.com authored
      The tcg_dus field used to contain *uses* of type and class decls,
      but not *defs*.  That was inconsistent, and it really went wrong
      for Template Haskell bracket.  What happened was that
       foo = [d| data A = A
             	   f :: A -> A
             	   f x = x |]
      would find a "use" of A when processing the top level of the module,
      which in turn led to a mkUsageInfo panic in MkIface.  The cause was
      the fact that the tcg_dus for the nested quote didn't have defs for
      A.
      b2d9ef84
    • 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
  13. 09 Apr, 2010 1 commit
    • simonpj@microsoft.com's avatar
      Fix Trac #3955: renamer and type variables · b87e22d2
      simonpj@microsoft.com authored
      The renamer wasn't computing the free variables of a type declaration
      properly.  This patch refactors a bit, and makes it more robust,
      fixing #3955 and several other closely-related bugs.  (We were
      omitting some free variables and that could just possibly lead to a
      usage-version tracking error.
      b87e22d2
  14. 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
  15. 10 Feb, 2010 1 commit
    • 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
  16. 08 Feb, 2010 1 commit
    • simonpj@microsoft.com's avatar
      Fix Trac #3850 · dafabe65
      simonpj@microsoft.com authored
      This patch simply avoids a needless difference in behaviour from 
      6.10, and one that happens to affect HList. See Note [Stupid theta].
      dafabe65
  17. 04 Jan, 2010 1 commit
  18. 02 Jan, 2010 1 commit
  19. 05 Nov, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Fix Trac #3640, plus associated refactoring · df8b00e0
      simonpj@microsoft.com authored
      In fixing this bug (to do with record puns), I had the usual rush of
      blood to the head, and I did quite a bit of refactoring in the way
      that duplicate/shadowed names are reported.
      
      I think the result is shorter as well as clearer.
      
      In one place I found it convenient for the renamer to use the ErrCtxt
      carried in the monad.  (The renamer used not to have such a context,
      but years ago the typechecker and renamer monads became one, so now it
      does.)   So now it's availble if you want it in future.
      df8b00e0
  20. 02 Oct, 2009 1 commit
  21. 26 Aug, 2009 1 commit
  22. 25 Aug, 2009 1 commit
  23. 20 Aug, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Improvements to record puns, wildcards · d64022dc
      simonpj@microsoft.com authored
      * Make C { A.a } work with punning, expanding to C { A.a = a }
      
      * Make it so that, with -fwarn-unused-matches, 
              f (C {..}) = x
        does not complain about the bindings introduced by the "..".
      
      * Make -XRecordWildCards implies -XDisambiguateRecordFields.
      
      * Overall refactoring of RnPat, which had become very crufty. 
        In particular, there is now a monad, CpsRn, private to RnPat,
        which deals with the cps-style plumbing.  This is why so many
        lines of RnPat have changed.
      
      * Refactor the treatment of renaming of record fields into two passes
      	- rnHsRecFields1, used both for patterns and expressions,
      	     which expands puns, wild-cards
        	- a local renamer in RnPat for fields in patterns
      	- a local renamer in RnExpr for fields in construction and update
        This make it all MUCH easier to understand
       
      * Improve documentation of record puns, wildcards, and disambiguation
      d64022dc
  24. 27 Jul, 2009 1 commit
  25. 24 Jul, 2009 1 commit
  26. 23 Jul, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Add tuple sections as a new feature · 58521c72
      simonpj@microsoft.com authored
      This patch adds tuple sections, so that
      
      	(x,,z)  means   \y -> (x,y,z)
      
      Thanks for Max Bolinbroke for doing the hard work.
      
      In the end, instead of using two constructors in HsSyn, I used
      just one (still called ExplicitTuple) whose arguments can be
      	Present (LHsExpr id)
      or	Missing PostTcType
      
      While I was at it, I did a bit of refactoring too.
      58521c72
  27. 07 Jul, 2009 1 commit
  28. 02 Jul, 2009 2 commits
    • chak@cse.unsw.edu.au.'s avatar
      1a77fd71
    • 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
  29. 27 May, 2009 2 commits
    • simonpj@microsoft.com's avatar
      Fix Trac #3221: renamer warnings for deriving clauses · 685f6314
      simonpj@microsoft.com authored
      This patch arranges to gather the variables used by 'deriving' clauses,
      so that unused bindings are correctly reported.
      685f6314
    • simonpj@microsoft.com's avatar
      Template Haskell: allow type splices · 389cca21
      simonpj@microsoft.com authored
      At last!  Trac #1476 and #3177
      
      This patch extends Template Haskell by allowing splices in
      types.  For example
      
        f :: Int -> $(burble 3)
      
      A type splice should work anywhere a type is expected.  This feature
      has been long requested, and quite a while ago I'd re-engineered the
      type checker to make it easier, but had never got around to finishing
      the job.  With luck, this does it.
      
      There's a ToDo in the HsSpliceTy case of RnTypes.rnHsType, where I
      am not dealing properly with the used variables; but that's awaiting
      the refactoring of the way we report unused names.
      
      
      389cca21
  30. 09 Apr, 2009 1 commit
  31. 08 Jan, 2009 1 commit
  32. 30 Oct, 2008 1 commit
    • simonpj@microsoft.com's avatar
      Add (a) CoreM monad, (b) new Annotations feature · 9bcd95ba
      simonpj@microsoft.com authored
      This patch, written by Max Bolingbroke,  does two things
      
      1.  It adds a new CoreM monad (defined in simplCore/CoreMonad),
          which is used as the top-level monad for all the Core-to-Core
          transformations (starting at SimplCore).  It supports
             * I/O (for debug printing)
             * Unique supply
             * Statistics gathering
             * Access to the HscEnv, RuleBase, Annotations, Module
          The patch therefore refactors the top "skin" of every Core-to-Core
          pass, but does not change their functionality.
      
      2.  It adds a completely new facility to GHC: Core "annotations".
          The idea is that you can say
             {#- ANN foo (Just "Hello") #-}
          which adds the annotation (Just "Hello") to the top level function
          foo.  These annotations can be looked up in any Core-to-Core pass,
          and are persisted into interface files.  (Hence a Core-to-Core pass
          can also query the annotations of imported things.)  Furthermore,
          a Core-to-Core pass can add new annotations (eg strictness info)
          of its own, which can be queried by importing modules.
      
      The design of the annotation system is somewhat in flux.  It's
      designed to work with the (upcoming) dynamic plug-ins mechanism,
      but is meanwhile independently useful.
      
      Do not merge to 6.10!  
      9bcd95ba
  33. 28 Oct, 2008 1 commit
  34. 27 Oct, 2008 1 commit
  35. 23 Sep, 2008 1 commit
    • simonpj@microsoft.com's avatar
      Allow type families to use GADT syntax (and be GADTs) · 7299e42c
      simonpj@microsoft.com authored
      We've always intended to allow you to use GADT syntax for
      data families:
      	data instance T [a] where
      	  T1 :: a -> T [a]
      and indeed to allow data instances to *be* GADTs
      	data intsance T [a] where
      	  T1 :: Int -> T [Int]
      	  T2 :: a -> b -> T [(a,b)]
      
      This patch fixes the renamer and type checker to allow this.
      	
      7299e42c
  36. 03 Oct, 2008 1 commit
    • simonpj@microsoft.com's avatar
      Expunge ThFake, cure Trac #2632 · 08a9d734
      simonpj@microsoft.com authored
      This patch fixes a dirty hack (the fake ThFake module), which in turn
      was causing Trac #2632.
      
      The new scheme is that the top-level binders in a TH [d| ... |] decl splice
      get Internal names.  That breaks a previous invariant that things like
      TyCons always have External names, but these TyCons are never long-lived;
      they live only long enough to typecheck the TH quotation; the result is
      discarded.  So it seems cool.
      
      Nevertheless -- Template Haskell folk: please test your code.  The testsuite
      is OK but it's conceivable that I've broken something in TH.  Let's see.
      08a9d734