1. 10 Feb, 2015 1 commit
    • Simon Peyton Jones's avatar
      Refactor the handling of quasi-quotes · f46360ed
      Simon Peyton Jones authored
      As Trac #10047 points out, a quasi-quotation [n|...blah...|] is supposed
      to behave exactly like $(n "...blah...").  But it doesn't!  This was outright
      wrong: quasiquotes were being run even inside brackets.
      
      Now that TH supports both typed and untyped splices, a quasi-quote is properly
      regarded as a particular syntax for an untyped splice. But apart from that
      they should be treated the same.  So this patch refactors the handling of
      quasiquotes to do just that.
      
      The changes touch quite a lot of files, but mostly in a routine way.
      The biggest changes by far are in RnSplice, and more minor changes in
      TcSplice.  These are the places where there was real work to be done.
      Everything else is routine knock-on changes.
      
      * No more QuasiQuote forms in declarations, expressions, types, etc.
        So we get rid of these data constructors
          * HsBinds.QuasiQuoteD
          * HsExpr.HsSpliceE
          * HsPat.QuasiQuotePat
          * HsType.HsQuasiQuoteTy
      
      * We get rid of the HsQuasiQuote type altogether
      
      * Instead, we augment the HsExpr.HsSplice type to have three
        consructors, for the three types of splice:
          * HsTypedSplice
          * HsUntypedSplice
          * HsQuasiQuote
        There are some related changes in the data types in HsExpr near HsSplice.
        Specifically: PendingRnSplice, PendingTcSplice, UntypedSpliceFlavour.
      
      * In Hooks, we combine rnQuasiQuoteHook and rnRnSpliceHook into one.
        A smaller, clearer interface.
      
      * We have to update the Haddock submodule, to accommodate the hsSyn changes
      f46360ed
  2. 03 Dec, 2014 1 commit
  3. 06 Sep, 2014 1 commit
  4. 25 Nov, 2013 1 commit
    • Simon Peyton Jones's avatar
      Another raft of Template Haskell clean-up · 51deeb0d
      Simon Peyton Jones authored
      The handling of typed and untyped brackets was extremely convoluted,
      partly because of the evolutionary history.  I've tidied it all up.
      
      See Note [How brackets and nested splices are handled] in TcSplice
      for the full story
      
      Main changes:
      
       * Untyped brackets: after the renamer, HsRnBracketOut carries
         PendingRnSplices for splices in untyped brackets.  In the
         typechecker, these pending splices are typechecked quite
         straigtforwardly, with no ps_var nonsense.
      
       * Typed brackets: after the renamer typed brackest still look
         like HsBracket. The type checker does the ps_var thing.
      
       * In TcRnTypes.ThStage, the Brack constructor, we distinguish
         the renaming from typehecking pending-stuff.  Much more
         perspicuous!
      
       * The "typed" flag is in HsSpliceE, not in HsSplice, because
         only expressions can be typed.  Patterns, types, declarations
         cannot.
      
      There is further improvement to be done to make the handling of
      declaration splices more uniform.
      51deeb0d
  5. 04 Oct, 2013 1 commit
  6. 12 Feb, 2013 1 commit
    • jpm@cs.ox.ac.uk's avatar
      Implement poly-kinded Typeable · 72b0ba09
      jpm@cs.ox.ac.uk authored
      This patch makes the Data.Typeable.Typeable class work with arguments of any
      kind. In particular, this removes the Typeable1..7 class hierarchy, greatly
      simplyfing the whole Typeable story. Also added is the AutoDeriveTypeable
      language extension, which will automatically derive Typeable for all types and
      classes declared in that module. Since there is now no good reason to give
      handwritten instances of the Typeable class, those are ignored (for backwards
      compatibility), and a warning is emitted.
      
      The old, kind-* Typeable class is now called OldTypeable, and lives in the
      Data.OldTypeable module. It is deprecated, and should be removed in some future
      version of GHC.
      72b0ba09
  7. 03 Oct, 2012 1 commit
    • Simon Peyton Jones's avatar
      This big patch re-factors the way in which arrow-syntax is handled · ba56d20d
      Simon Peyton Jones authored
      All the work was done by Dan Winograd-Cort.
      
      The main thing is that arrow comamnds now have their own
      data type HsCmd (defined in HsExpr).  Previously it was
      punned with the HsExpr type, which was jolly confusing,
      and made it hard to do anything arrow-specific.
      
      To make this work, we now parameterise
        * MatchGroup
        * Match
        * GRHSs, GRHS
        * StmtLR and friends
      over the "body", that is the kind of thing they
      enclose.  This "body" parameter can be instantiated to
      either LHsExpr or LHsCmd respectively.
      
      Everything else is really a knock-on effect; there should
      be no change (yet!) in behaviour.  But it should be a sounder
      basis for fixing bugs.
      ba56d20d
  8. 26 Jan, 2012 1 commit
  9. 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
  10. 04 Nov, 2011 1 commit
  11. 13 Dec, 2010 1 commit
    • simonpj@microsoft.com's avatar
      Fix recursive superclasses (again). Fixes Trac #4809. · a3bab050
      simonpj@microsoft.com authored
      This patch finally deals with the super-delicate question of
      superclases in possibly-recursive dictionaries.  The key idea
      is the DFun Superclass Invariant (see TcInstDcls):
      
           In the body of a DFun, every superclass argument to the
           returned dictionary is
             either   * one of the arguments of the DFun,
             or       * constant, bound at top level
      
      To establish the invariant, we add new "silent" superclass
      argument(s) to each dfun, so that the dfun does not do superclass
      selection internally.  There's a bit of hoo-ha to make sure that
      we don't print those silent arguments in error messages; a knock
      on effect was a change in interface-file format.
      
      A second change is that instead of the complex and fragile
      "self dictionary binding" in TcInstDcls and TcClassDcl,
      using the same mechanism for existential pattern bindings.
      See Note [Subtle interaction of recursion and overlap] in TcInstDcls
      and Note [Binding when looking up instances] in InstEnv.
      
      Main notes are here:
      
        * Note [Silent Superclass Arguments] in TcInstDcls,
          including the DFun Superclass Invariant
      
      Main code changes are:
      
        * The code for MkId.mkDictFunId and mkDictFunTy
      
        * DFunUnfoldings get a little more complicated;
          their arguments are a new type DFunArg (in CoreSyn)
      
        * No "self" argument in tcInstanceMethod
        * No special tcSimplifySuperClasss
        * No "dependents" argument to EvDFunApp
      
      IMPORTANT
         It turns out that it's quite tricky to generate the right
         DFunUnfolding for a specialised dfun, when you use SPECIALISE
         INSTANCE.  For now I've just commented it out (in DsBinds) but
         that'll lose some optimisation, and I need to get back to
         this.
      a3bab050
  12. 30 Mar, 2010 1 commit
  13. 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.
      6a05ec5e
  14. 22 Aug, 2007 1 commit
  15. 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.
      0065d5ab
  16. 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
          do-notation.
      
      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.)
      d551dbfe
  17. 27 Jan, 2005 1 commit
    • simonpj's avatar
      [project @ 2005-01-27 10:44:00 by simonpj] · 508a505e
      simonpj authored
      --------------------------------------------
                Replace hi-boot files with hs-boot files
        	--------------------------------------------
      
      This major commit completely re-organises the way that recursive modules
      are dealt with.
      
        * It should have NO EFFECT if you do not use recursive modules
      
        * It is a BREAKING CHANGE if you do
      
      ====== Warning: .hi-file format has changed, so if you are
      ======		updating into an existing HEAD build, you'll
      ======		need to make clean and re-make
      
      
      The details:  [documentation still to be done]
      
      * Recursive loops are now broken with Foo.hs-boot (or Foo.lhs-boot),
        not Foo.hi-boot
      
      * An hs-boot files is a proper source file.  It is compiled just like
        a regular Haskell source file:
      	ghc Foo.hs		generates Foo.hi, Foo.o
      	ghc Foo.hs-boot		generates Foo.hi-boot, Foo.o-boot
      
      * hs-boot files are precisely a subset of Haskell. In particular:
      	- they have the same import, export, and scoping rules
      	- errors (such as kind errors) in hs-boot files are checked
        You do *not* need to mention the "original" name of something in
        an hs-boot file, any more than you do in any other Haskell module.
      
      * The Foo.hi-boot file generated by compiling Foo.hs-boot is a machine-
        generated interface file, in precisely the same format as Foo.hi
      
      * When compiling Foo.hs, its exports are checked for compatibility with
        Foo.hi-boot (previously generated by compiling Foo.hs-boot)
      
      * The dependency analyser (ghc -M) knows about Foo.hs-boot files, and
        generates appropriate dependencies.  For regular source files it
        generates
      	Foo.o : Foo.hs
      	Foo.o : Baz.hi		-- Foo.hs imports Baz
      	Foo.o : Bog.hi-boot	-- Foo.hs source-imports Bog
      
        For a hs-boot file it generates similar dependencies
      	Bog.o-boot : Bog.hs-boot
      	Bog.o-boot : Nib.hi	-- Bog.hs-boto imports Nib
      
      * ghc -M is also enhanced to use the compilation manager dependency
        chasing, so that
      	ghc -M Main
        will usually do the job.  No need to enumerate all the source files.
      
      * The -c flag is no longer a "compiler mode". It simply means "omit the
        link step", and synonymous with -no-link.
      508a505e