1. 09 Feb, 2014 2 commits
    • cactus's avatar
      Issue an error for pattern synonyms defined in a local scope (#8757) · e0a55415
      cactus authored
      This also fixes the internal crash when using pattern synonyms
      in GHCi (#8749)
      e0a55415
    • eir@cis.upenn.edu's avatar
      Fix #8631. · 674c969c
      eir@cis.upenn.edu authored
      This patch allows turning on ImpredicativeTypes while type-checking
      the code generated by GeneralizedNewtypeDeriving. It does this
      by adding a field ib_extensions to InstBindings, informing the
      type-checker what extensions should be enabled while type-checking
      the instance.
      674c969c
  2. 07 Feb, 2014 1 commit
    • Joachim Breitner's avatar
      In deepSplitCprType_maybe, be more forgiving · 312686c1
      Joachim Breitner authored
      the ConTag may be out of range (e.g. if the type constructor is imported
      via SOURCE and we don't know any of its data constructors); just return
      Nothing without complaining in that case. This fixes #8743.
      312686c1
  3. 03 Feb, 2014 2 commits
    • Jan Stolarek's avatar
      Eliminate duplicate code in Cmm pipeline · dba9bf67
      Jan Stolarek authored
      End of Cmm pipeline used to be split into two alternative flows,
      depending on whether we did proc-point splitting or not. There
      was a lot of code duplication between these two branches. But it
      wasn't really necessary as the differences can be easily enclosed
      within an if-then-else. I observed no impact of this change on
      compilation performance.
      dba9bf67
    • Jan Stolarek's avatar
      Document deprecations in Hoopl · 526cbc7a
      Jan Stolarek authored
      526cbc7a
  4. 02 Feb, 2014 2 commits
  5. 01 Feb, 2014 5 commits
  6. 30 Jan, 2014 1 commit
  7. 28 Jan, 2014 3 commits
  8. 26 Jan, 2014 1 commit
  9. 23 Jan, 2014 2 commits
    • Gabor Greif's avatar
      Some typos in comments · e01367ff
      Gabor Greif authored
      e01367ff
    • Joachim Breitner's avatar
      Some polishing of the demand analyser. · 8d34ae39
      Joachim Breitner authored
      I did some refactoring of the demand analyser, because I was smelling
      some minor code smell. Most of my changes I had to undo, though,
      adding notes and testcases on why the existing code was correct after
      all.
      
      Especially the semantics of the DmdResult is confusing, as it differs in
      a DmdType and a StrictSig.
      
      I got to imrpove the readability of the code for lubDmdType, though.
      
      Also, dmdAnalRhs was a bit fishy in how it removed the demand on
      further arguments of the body, but used the DmdResult. This would be
      wrong if a body would return a demand type of "<L>m" (which currently
      does not happen).  This is now treated better in removeDmdTyArgs.
      8d34ae39
  10. 21 Jan, 2014 1 commit
    • Austin Seipp's avatar
      Fix #8677 (fallout from #8180) · 0a2d323c
      Austin Seipp authored
      When using TemplateHaskell and -prof, we *do not* want -dynamic-too, because
      we're going to *expect* that you compiled the vanilla/dyn way already,
      and are compiling profiling the second time (i.e. so GHCi can just load
      the normal, non-profiled object files.)
      Signed-off-by: default avatarAustin Seipp <austin@well-typed.com>
      0a2d323c
  11. 20 Jan, 2014 4 commits
    • cactus's avatar
      Implement pattern synonyms · 4f8369bf
      cactus 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/ImplementationReviewed-by: Simon Peyton Jones's avatarSimon Peyton Jones <simonpj@microsoft.com>
      Signed-off-by: default avatarAustin Seipp <austin@well-typed.com>
      4f8369bf
    • Joachim Breitner's avatar
    • Joachim Breitner's avatar
      Simplify doCorePass · 0c578870
      Joachim Breitner authored
      0c578870
    • Joachim Breitner's avatar
      Make worker-wrapper unbox data families · 2bb19fad
      Joachim Breitner authored
      by passing the FamInstEnvs all the way down. This closes #7619.
      2bb19fad
  12. 18 Jan, 2014 1 commit
    • pali.gabor@gmail.com's avatar
      Fix #8451 · 1ad599ea
      pali.gabor@gmail.com authored
      On FreeBSD, /usr/lib has to be added to the library path on linking when
      libthr is needed but -nostdlib is used (which is the case when the -prof
      and -threaded flags are combined).
      1ad599ea
  13. 17 Jan, 2014 4 commits
  14. 16 Jan, 2014 11 commits
    • Krzysztof Gogolewski's avatar
      Typos in comments · 98db754a
      Krzysztof Gogolewski authored
      98db754a
    • Joachim Breitner's avatar
      ...and clean up the imports · 59f491a9
      Joachim Breitner authored
      59f491a9
    • Joachim Breitner's avatar
      Remove unused returnsCPR · b26e2f92
      Joachim Breitner authored
      b26e2f92
    • Joachim Breitner's avatar
      Refactor WorkWrap, get rid of worthSplittingArgDmd · 7cdf141d
      Joachim Breitner authored
      Instead of first checking whether splitting is useful, and then firing
      up the worker-wrapper-machinery, which will do the same checks again, we
      now simply generate a worker and wrapper, and while doing so keep track
      of whether what we did was in any way useful.
      
      So now there is only one place left where we decide whether we want to
      do w/w, and that place has access to more information, in particular the
      actual types at hand.
      7cdf141d
    • Joachim Breitner's avatar
      Replace worthSplittingThunkDmd by worthSplittingArgDmd · ab74d75d
      Joachim Breitner authored
      these functions were almost equal, and neither validate nor nofib show
      any difference replacing one by the other. So lets simplify this.
      (This also prepares for a refactoring that will get rid of
      worthSplittingArgDmd completely.)
      ab74d75d
    • Simon Marlow's avatar
      Allow the argument to 'reserve' to be a compile-time expression · 58e5843a
      Simon Marlow authored
      By using the constant-folder to reduce it to an integer.
      58e5843a
    • Simon Marlow's avatar
      Add a way to reserve temporary stack space in high-level Cmm · eaa37a0f
      Simon Marlow authored
      We occasionally need to reserve some temporary memory in a primop for
      passing to a foreign function.  We've been using the stack for this,
      but when we moved to high-level Cmm it became quite fragile because
      primops are in high-level Cmm and the stack is supposed to be under
      the control of the Cmm pipeline.
      
      So this change puts things on a firmer footing by adding a new Cmm
      construct 'reserve'.  e.g. in decodeFloat_Int#:
      
          reserve 2 = tmp {
      
            mp_tmp1  = tmp + WDS(1);
            mp_tmp_w = tmp;
      
            /* Perform the operation */
            ccall __decodeFloat_Int(mp_tmp1 "ptr", mp_tmp_w "ptr", arg);
      
            r1 = W_[mp_tmp1];
            r2 = W_[mp_tmp_w];
          }
      
      reserve is described in CmmParse.y.
      
      Unfortunately the argument to reserve must be a compile-time constant.
      We might have to extend the parser to allow expressions with
      arithmetic operators if this is too restrictive.
      
      Note also that the return instruction for the procedure must be
      outside the scope of the reserved stack area, so we have to extract
      the values from the reserved area before we close the scope.  This
      means some more local variables (r1, r2 in the example above).  The
      generated code is more or less identical to what we had before though.
      eaa37a0f
    • Gabor Greif's avatar
      Typo in comment · 11f5cd94
      Gabor Greif authored
      11f5cd94
    • Simon Marlow's avatar
      Documentation on the stack layout algorithm · 78a506a9
      Simon Marlow authored
      78a506a9
    • Simon Marlow's avatar
      Disable -fregs-graph (#7679, #8657) · f0a7261a
      Simon Marlow authored
      f0a7261a
    • Austin Seipp's avatar
      Don't pass -nodefaultlibs to Clang · d0ed1ff1
      Austin Seipp authored
      This fixes a large majority of the testsuite failures on Mavericks with
      Clang.
      Signed-off-by: default avatarAustin Seipp <austin@well-typed.com>
      d0ed1ff1