1. 20 Nov, 2014 1 commit
  2. 07 Nov, 2014 1 commit
    • rodlogic's avatar
      small parser/lexer cleanup · 37d64a51
      rodlogic authored
      Summary:
      The last three '#define ...' macros were removed from Parser.y.pp and this file was renamed to Parser.y.
      This basically got rid of a CPP step in the build.
      
      Also converted two modules in compiler/parser/ from .lhs to .hs.
      
      Test Plan: Does it build? Yes, I performed a full build here and things are looking good.
      
      Reviewers: austin
      
      Reviewed By: austin
      
      Subscribers: adamse, thomie, carter, simonmar
      
      Differential Revision: https://phabricator.haskell.org/D411
      37d64a51
  3. 26 Sep, 2014 2 commits
  4. 18 Sep, 2014 1 commit
    • Krzysztof Gogolewski's avatar
      Add -fwarn-context-quantification (#4426) · 275dcafb
      Krzysztof Gogolewski authored
      Summary:
      This warning (enabled by default) reports places where a context
      implicitly binds a type variable, for example
      
      type T a = {-forall m.-} Monad m => a -> m a
      
      Also update Haddock submodule.
      
      Test Plan: validate
      
      Reviewers: hvr, goldfire, simonpj, austin
      
      Reviewed By: austin
      
      Subscribers: simonmar, ezyang, carter
      
      Differential Revision: https://phabricator.haskell.org/D211
      
      GHC Trac Issues: #4426
      275dcafb
  5. 09 Sep, 2014 1 commit
    • Austin Seipp's avatar
      Make Applicative a superclass of Monad · d94de872
      Austin Seipp authored
      
      
      Summary:
      This includes pretty much all the changes needed to make `Applicative`
      a superclass of `Monad` finally. There's mostly reshuffling in the
      interests of avoid orphans and boot files, but luckily we can resolve
      all of them, pretty much. The only catch was that
      Alternative/MonadPlus also had to go into Prelude to avoid this.
      
      As a result, we must update the hsc2hs and haddock submodules.
      Signed-off-by: default avatarAustin Seipp <austin@well-typed.com>
      
      Test Plan: Build things, they might not explode horribly.
      
      Reviewers: hvr, simonmar
      
      Subscribers: simonmar
      
      Differential Revision: https://phabricator.haskell.org/D13
      d94de872
  6. 06 Sep, 2014 1 commit
  7. 01 Sep, 2014 1 commit
    • thomie's avatar
      Make Lexer.x more like the 2010 report · 64c9898f
      thomie authored
      Summary:
      I tried reading the lexer and the 2010 report side-by-side. Althought I didn't
      quite finish, here are some small discrepancies that I found.
      
      This revision may be low priority for reviewers, but having these commits just
      in my local repository does no good either.
      
      Changes:
      * $nl was defined, but not used anywhere
      * formfeed is a newline character
      * add \: to $ascsymbol
        For simplification reason, the colon (':') was added to the character
        set $ascsymbol in the 2010 report. Here we make the same change.
      * introduce the macros `qvarid`, `qconid`, `qvarsym` and `qconsym`
      * foreign is a Haskell keyword
      * add/update comments
      
      Test Plan: Harbormaster (is awesome)
      
      Reviewers: simonmar, hvr, austin
      
      Reviewed By: austin
      
      Subscribers: hvr, simonmar, ezyang, carter
      
      Differential Revision: https://phabricator.haskell.org/D180
      64c9898f
  8. 25 Aug, 2014 1 commit
  9. 29 Jul, 2014 2 commits
  10. 27 Jul, 2014 1 commit
    • Iavor S. Diatchki's avatar
      Implement OVERLAPPING and OVERLAPPABLE pragmas (see #9242) · 97f499b5
      Iavor S. Diatchki authored
      This also removes the short-lived NO_OVERLAP pragama, and renames
      OVERLAP to OVERLAPS.
      
      An instance may be annotated with one of 4 pragams, to control its
      interaction with other overlapping instances:
      
        * OVERLAPPABLE:
          this instance is ignored if a more specific candidate exists
      
        * OVERLAPPING:
          this instance is preferred over more general candidates
      
        * OVERLAPS:
          both OVERLAPPING and OVERLAPPABLE (i.e., the previous GHC behavior).
          When compiling with -XOverlappingInstances, all instance are OVERLAPS.
      
        * INCOHERENT:
          same as before (see manual for details).
          When compiling with -XIncoherentInstances, all instances are INCOHERENT.
      97f499b5
  11. 21 Jul, 2014 1 commit
    • Edward Z. Yang's avatar
      Rename PackageId to PackageKey, distinguishing it from Cabal's PackageId. · 4bebab25
      Edward Z. Yang authored
      
      
      Summary:
      Previously, both Cabal and GHC defined the type PackageId, and we expected
      them to be roughly equivalent (but represented differently).  This refactoring
      separates these two notions.
      
      A package ID is a user-visible identifier; it's the thing you write in a
      Cabal file, e.g. containers-0.9.  The components of this ID are semantically
      meaningful, and decompose into a package name and a package vrsion.
      
      A package key is an opaque identifier used by GHC to generate linking symbols.
      Presently, it just consists of a package name and a package version, but
      pursuant to #9265 we are planning to extend it to record other information.
      Within a single executable, it uniquely identifies a package.  It is *not* an
      InstalledPackageId, as the choice of a package key affects the ABI of a package
      (whereas an InstalledPackageId is computed after compilation.)  Cabal computes
      a package key for the package and passes it to GHC using -package-name (now
      *extremely* misnamed).
      
      As an added bonus, we don't have to worry about shadowing anymore.
      
      As a follow on, we should introduce -current-package-key having the same role as
      -package-name, and deprecate the old flag.  This commit is just renaming.
      
      The haddock submodule needed to be updated.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: simonpj, simonmar, hvr, austin
      
      Subscribers: simonmar, relrod, carter
      
      Differential Revision: https://phabricator.haskell.org/D79
      
      Conflicts:
      	compiler/main/HscTypes.lhs
      	compiler/main/Packages.lhs
      	utils/haddock
      4bebab25
  12. 20 Jul, 2014 3 commits
  13. 15 Jul, 2014 1 commit
    • Simon Peyton Jones's avatar
      Entirely re-jig the handling of default type-family instances (fixes Trac #9063) · 9b8ba629
      Simon Peyton Jones authored
      In looking at Trac #9063 I decided to re-design the default
      instances for associated type synonyms.  Previously it was all
      jolly complicated, to support generality that no one wanted, and
      was arguably undesirable.
      
      Specifically
      
      * The default instance for an associated type can have only
        type variables on the LHS.  (Not type patterns.)
      
      * There can be at most one default instances declaration for
        each associated type.
      
      To achieve this I had to do a surprisingly large amount of refactoring
      of HsSyn, specifically to parameterise HsDecls.TyFamEqn over the type
      of the LHS patterns.
      
      That change in HsDecls has a (trivial) knock-on effect in Haddock, so
      this commit does a submodule update too.
      
      The net result is good though.  The code is simpler; the language
      specification is simpler.  Happy days.
      
      Trac #9263 and #9264 are thereby fixed as well.
      9b8ba629
  14. 30 Jun, 2014 1 commit
    • Iavor S. Diatchki's avatar
      Overlapable pragmas for individual instances (#9242) · 6290eead
      Iavor S. Diatchki authored
      Programmers may provide a pragma immediately after the `instance` keyword
      to control the overlap/incoherence behavior for individual instances.
      For example:
      
          instance {-# OVERLAP #-} C a where ...
      
      I chose this notation, rather than the other two outlined in the ticket
      for these reasons:
      
         1. Having the pragma after the type looks odd, I think.
         2. Having the pragma after there `where` does not work for
             stand-alone derived instances
      
      I have implemented 3 pragams:
      
         1. NO_OVERLAP
         2. OVERLAP
         3. INCOHERENT
      
      These correspond directly to the internal modes currently supported by
      GHC.  If a pragma is specified, it will be used no matter what flags are
      turned on.   For example, putting `NO_OVERLAP` on an instance will mark
      it as non-overlapping, even if `OVERLAPPIN_INSTANCES` is turned on for the
      module.
      6290eead
  15. 27 Jun, 2014 2 commits
    • Herbert Valerio Riedel's avatar
      Add -XBinaryLiterals language extension (re #9224) · 1c0b5fdc
      Herbert Valerio Riedel authored
      
      
      Haskell2010 supports
      
      - base-10 (prefix-less),
      - base-8 (via `0[oO]`-prefix), and
      - base-16 (via `0[xX]`-prefix) integer literals.
      
      This commit adds syntax support for base-2 integer literals via the new `0[bB]`
      prefix. The use of a `0b` prefix for indicating binary literals is known
      from popular programming languages such as C++14, Perl, Python, Ruby, and Java.
      
      This syntax extension is disabled by default and can be enabled via the
      new `{-# LANGUAGE BinaryLiterals #-}` pragma and/or the new `-XBinaryLiterals`
      
      This new extensions requires to upgrade the `ExtsBitmap` type from
      `Word` to `Word64` as this adds a 33th flag which is not guaranteed to
      fit into a `Word`.
      Signed-off-by: Herbert Valerio Riedel's avatarHerbert Valerio Riedel <hvr@gnu.org>
      
      Differential Revision: https://phabricator.haskell.org/D22
      1c0b5fdc
    • Herbert Valerio Riedel's avatar
      Refactor extension-bitmap in Lexer · b80d5739
      Herbert Valerio Riedel authored
      This introduces an Enum type `ExtBits` for the currently used 32 flags
      and introduces a type-synonym `ExtsBitmap` for representing a set over
      `ExtBits`. While at it, the current `Int` was replaced by `Word` to
      have the compiler catch any missed use-sites.
      
      This will make it easy to swap the `Word`-representation of `ExtsBitmap`
      by something different, such as e.g. a `Word64`
      
      Test Plan: successful validate
      
      Differential Revision: https://phabricator.haskell.org/D23
      b80d5739
  16. 05 Jun, 2014 1 commit
    • Simon Peyton Jones's avatar
      Fix egregious instantiation bug in matchOneConLike (fixing Trac #9023) · 0a55a3ca
      Simon Peyton Jones authored
      We simply weren't giving anything like the right instantiating types
      to patSynInstArgTys in matchOneConLike.
      
      To get these instantiating types would have involved matching the
      result type of the pattern synonym with the pattern type, which is
      tiresome.  So instead I changed ConPatOut so that instead of recording
      the type of the *whole* pattern (in old field pat_ty), it not records
      the *instantiating* types (in new field pat_arg_tys).  Then we canuse
      TcHsSyn.conLikeResTy to get the pattern type when needed.
      
      There are lots of knock-on incidental effects, but they mostly made
      the code simpler, so I'm happy.
      0a55a3ca
  17. 15 May, 2014 1 commit
    • Herbert Valerio Riedel's avatar
      Add LANGUAGE pragmas to compiler/ source files · 23892440
      Herbert Valerio Riedel authored
      In some cases, the layout of the LANGUAGE/OPTIONS_GHC lines has been
      reorganized, while following the convention, to
      
      - place `{-# LANGUAGE #-}` pragmas at the top of the source file, before
        any `{-# OPTIONS_GHC #-}`-lines.
      
      - Moreover, if the list of language extensions fit into a single
        `{-# LANGUAGE ... -#}`-line (shorter than 80 characters), keep it on one
        line. Otherwise split into `{-# LANGUAGE ... -#}`-lines for each
        individual language extension. In both cases, try to keep the
        enumeration alphabetically ordered.
        (The latter layout is preferable as it's more diff-friendly)
      
      While at it, this also replaces obsolete `{-# OPTIONS ... #-}` pragma
      occurences by `{-# OPTIONS_GHC ... #-}` pragmas.
      23892440
  18. 03 May, 2014 1 commit
  19. 13 Apr, 2014 1 commit
  20. 03 Apr, 2014 1 commit
  21. 20 Feb, 2014 1 commit
  22. 13 Feb, 2014 1 commit
  23. 20 Jan, 2014 1 commit
    • Gergő Érdi's avatar
      Implement pattern synonyms · 4f8369bf
      Gergő Érdi authored
      This patch implements Pattern Synonyms (enabled by -XPatternSynonyms),
      allowing y ou to assign names to a pattern and abstract over it.
      
      The rundown is this:
      
        * Named patterns are introduced by the new 'pattern' keyword, and can
          be either *unidirectional* or *bidirectional*. A unidirectional
          pattern is, in the simplest sense, simply an 'alias' for a pattern,
          where the LHS may mention variables to occur in the RHS. A
          bidirectional pattern synonym occurs when a pattern may also be used
          in expression context.
      
        * Unidirectional patterns are declared like thus:
      
              pattern P x <- x:_
      
          The synonym 'P' may only occur in a pattern context:
      
              foo :: [Int] -> Maybe Int
              foo (P x) = Just x
              foo _     = Nothing
      
        * Bidirectional patterns are declared like thus:
      
              pattern P x y = [x, y]
      
          Here, P may not only occur as a pattern, but also as an expression
          when given values for 'x' and 'y', i.e.
      
              bar :: Int -> [Int]
              bar x = P x 10
      
        * Patterns can't yet have their own type signatures; signatures are inferred.
      
        * Pattern synonyms may not be recursive, c.f. type synonyms.
      
        * Pattern synonyms are also exported/imported using the 'pattern'
          keyword in an import/export decl, i.e.
      
              module Foo (pattern Bar) where ...
      
          Note that pattern synonyms share the namespace of constructors, so
          this disambiguation is required as a there may also be a 'Bar'
          type in scope as well as the 'Bar' pattern.
      
        * The semantics of a pattern synonym differ slightly from a typical
          pattern: when using a synonym, the pattern itself is matched,
          followed by all the arguments. This means that the strictness
          differs slightly:
      
              pattern P x y <- [x, y]
      
              f (P True True) = True
              f _             = False
      
              g [True, True] = True
              g _            = False
      
          In the example, while `g (False:undefined)` evaluates to False,
          `f (False:undefined)` results in undefined as both `x` and `y`
          arguments are matched to `True`.
      
      For more information, see the wiki:
      
          https://ghc.haskell.org/trac/ghc/wiki/PatternSynonyms
          https://ghc.haskell.org/trac/ghc/wiki/PatternSynonyms/Implementation
      
      Reviewed-by: Simon Peyton Jones's avatarSimon Peyton Jones <simonpj@microsoft.com>
      Signed-off-by: default avatarAustin Seipp <austin@well-typed.com>
      4f8369bf
  24. 18 Dec, 2013 1 commit
  25. 05 Dec, 2013 2 commits
  26. 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
  27. 22 Nov, 2013 1 commit
  28. 07 Nov, 2013 1 commit
  29. 06 Nov, 2013 1 commit
  30. 01 Nov, 2013 1 commit
  31. 17 Oct, 2013 1 commit
  32. 12 Oct, 2013 3 commits