1. 30 Jun, 2016 1 commit
    • niteria's avatar
      Remove ufmToList · 480e0661
      niteria authored
      This documents nondeterminism in code generation and removes
      the nondeterministic ufmToList function. In the future someone
      will have to use nonDetUFMToList (with proper explanation)
      or pprUFMWithKeys.
      480e0661
  2. 24 May, 2016 1 commit
    • niteria's avatar
      Document some benign nondeterminism · 4c6e69d5
      niteria authored
      I've changed the functions to their nonDet equivalents and explained
      why they're OK there. This allowed me to remove foldNameSet,
      foldVarEnv, foldVarEnv_Directly, foldVarSet and foldUFM_Directly.
      
      Test Plan: ./validate, there should be no change in behavior
      
      Reviewers: simonpj, simonmar, austin, goldfire, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2244
      
      GHC Trac Issues: #4012
      4c6e69d5
  3. 12 May, 2016 1 commit
  4. 11 May, 2016 1 commit
    • niteria's avatar
      Document SCC determinism · 3edbd091
      niteria authored
      I've documented the guarantees that stronglyConnCompFromEdgedVertices
      provides and commented on the call sites to explain why they are
      OK from determinism standpoint. I've changed the functions to
      nonDetUFM versions, so that it's explicit they could introduce
      nondeterminism.  I haven't defined container (VarSet, NameSet)
      specific versions, so that we have less functions to worry about.
      
      Test Plan: this is mostly just documentation,
      it should have no runtime effect
      
      Reviewers: bgamari, simonmar, austin, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2194
      
      GHC Trac Issues: #4012
      3edbd091
  5. 10 May, 2016 1 commit
    • niteria's avatar
      Get rid of Traversable UniqFM and Foldable UniqFM · 7e28e47c
      niteria authored
      Both Traversable and Foldable can introduce non-determinism
      and because of typeclass overloading it's implicit and not
      obvious at the call site. This removes the instances, so that
      they can't accidentally be used.
      
      Test Plan: ./validate
      
      Reviewers: austin, goldfire, bgamari, simonmar, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2190
      
      GHC Trac Issues: #4012
      7e28e47c
  6. 28 Apr, 2016 1 commit
    • niteria's avatar
      Add uniqSetAny and uniqSetAll and use them · 3c426b05
      niteria authored
      There are couple of places where we do `foldUniqSet` just to
      compute `any` or `all`. `foldUniqSet` is non-deterministic in the
      general case and `any` and `all` also read nicer.
      
      Test Plan: ./validate
      
      Reviewers: simonmar, goldfire, simonpj, bgamari, austin
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2156
      
      GHC Trac Issues: #4012
      3c426b05
  7. 26 Apr, 2016 1 commit
    • niteria's avatar
      Kill varSetElemsWellScoped in quantifyTyVars · c9bcaf31
      niteria authored
      varSetElemsWellScoped introduces unnecessary non-determinism in
      inferred type signatures.
      Removing this instance required changing the representation of
      TcDepVars to use deterministic sets.
      This is the last occurence of varSetElemsWellScoped, allowing me to
      finally remove it.
      
      Test Plan:
      ./validate
      I will update the expected outputs when commiting, some reordering
      of type variables in types is expected.
      
      Reviewers: goldfire, simonpj, austin, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: thomie, simonmar
      
      Differential Revision: https://phabricator.haskell.org/D2135
      
      GHC Trac Issues: #4012
      c9bcaf31
  8. 22 Apr, 2016 1 commit
    • niteria's avatar
      Make benign non-determinism in pretty-printing more obvious · 0f96686b
      niteria authored
      This change takes us one step closer to being able to remove
      `varSetElemsWellScoped`. The end goal is to make every source
      of non-determinism obvious at the source level, so that when
      we achieve determinism it doesn't get broken accidentally.
      
      Test Plan: compile GHC
      
      Reviewers: simonmar, goldfire, simonpj, austin, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2123
      
      GHC Trac Issues: #4012
      0f96686b
  9. 19 Jan, 2016 1 commit
    • niteria's avatar
      Check InScopeSet in substTy and provide substTyUnchecked · 9d33adb6
      niteria authored
      This adds sanity checks to `substTy` that implement:
      
      > when calling substTy subst ty it should be the case that the in-scope
      > set in the substitution is a superset of
      > * The free vars of the range of the substitution
      > * The free vars of ty minus the domain of the substitution
      
      and replaces violators with unchecked version. The violators were found
      by running the GHC test suite.
      
      This ensures that I can work on this incrementally and that what I fix won't
      be undone by some other change.
      
      It also includes a couple of fixes that I've already done.
      
      Test Plan: ./validate
      
      Reviewers: simonmar, goldfire, simonpj, austin, bgamari
      
      Reviewed By: simonpj, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1792
      
      GHC Trac Issues: #11371
      9d33adb6
  10. 18 Jan, 2016 1 commit
    • Jan Stolarek's avatar
      Replace calls to `ptext . sLit` with `text` · b8abd852
      Jan Stolarek authored
      Summary:
      In the past the canonical way for constructing an SDoc string literal was the
      composition `ptext . sLit`.  But for some time now we have function `text` that
      does the same.  Plus it has some rules that optimize its runtime behaviour.
      This patch takes all uses of `ptext . sLit` in the compiler and replaces them
      with calls to `text`.  The main benefits of this patch are clener (shorter) code
      and less dependencies between module, because many modules now do not need to
      import `FastString`.  I don't expect any performance benefits - we mostly use
      SDocs to report errors and it seems there is little to be gained here.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, austin, goldfire, hvr, alanz
      
      Subscribers: goldfire, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D1784
      b8abd852
  11. 31 Dec, 2015 1 commit
  12. 29 Nov, 2015 1 commit
    • quchen's avatar
      Implement warnings for Semigroups as parent of Monoid · 290def72
      quchen authored
      This patch is similar to the AMP patch (#8004), which offered two
      functions:
      
        1. Warn when an instance of a class has been given, but the type does
           not have a certain superclass instance
        2. Warn when top-level definitions conflict with future Prelude names
      
      These warnings are issued as part of the new `-Wcompat` warning group.
      
      Reviewers: hvr, ekmett, austin, bgamari
      
      Reviewed By: hvr, ekmett, bgamari
      
      Subscribers: ekmett, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1539
      
      GHC Trac Issues: #11139
      290def72
  13. 03 Sep, 2015 1 commit
  14. 17 Dec, 2014 1 commit
  15. 03 Dec, 2014 1 commit
  16. 05 Nov, 2014 1 commit
  17. 07 Oct, 2014 1 commit
  18. 21 Sep, 2014 1 commit
  19. 12 Jun, 2014 1 commit
  20. 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
  21. 05 Mar, 2014 1 commit
    • Joachim Breitner's avatar
      Major Call Arity rework · cb8a63cb
      Joachim Breitner authored
      This patch improves the call arity analysis in various ways.
      
      Most importantly, it enriches the analysis result information so that
      when looking at a call, we do not have to make a random choice about
      what side we want to take the information from. Instead we can combine
      the results in a way that does not lose valuable information.
      
      To do so, besides the incoming arities, we store remember "what can be
      called with what", i.e. an undirected graph between the (interesting)
      free variables of an expression. Of course it makes combining the
      results a bit more tricky (especially mutual recursion), but still
      doable.
      
      The actually implemation of the graph structure is abstractly put away
      in a module of its own (UnVarGraph.hs)
      
      The implementation is geared towards efficiently representing the graphs
      that we need (which can contain large complete and large complete
      bipartite graphs, which would be huge in other representations). If
      someone feels like designing data structures: There is surely some
      speed-up to be obtained by improving that data structure.
      
      Additionally, the analysis now takes into account that if a RHS stays a
      thunk, then its calls happen only once, even if the variables the RHS is
      bound to is evaluated multiple times, or is part of a recursive group.
      cb8a63cb
  22. 20 Jan, 2014 1 commit
    • 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
  23. 12 Jan, 2014 1 commit
  24. 16 Dec, 2013 1 commit
  25. 02 Aug, 2013 1 commit
  26. 01 Nov, 2012 1 commit
  27. 28 Aug, 2012 1 commit
  28. 05 Aug, 2012 1 commit
  29. 26 Feb, 2012 1 commit
  30. 28 Nov, 2011 1 commit
    • dimitris's avatar
      This patch includes: · f3183d9a
      dimitris authored
      0) Typo in panic message.
      1) prioritization of equalities over family equalities in the worklists.
      2) rewriting of inert substitutions and solveds on-the-spot instead of
         kicking them out in the inerts. This required a monadic map over
         substitutions hence the modifications in UniqFM.
      3) Just comments and removing stale commented code.
      
      4) Useful SCC for simplifyInfer.
      
      5) Making CoreStats outputable.
      f3183d9a
  31. 04 Nov, 2011 1 commit
  32. 28 Jul, 2011 1 commit
  33. 12 Jul, 2011 1 commit
  34. 29 Jun, 2011 1 commit
  35. 13 Apr, 2011 1 commit
  36. 11 Apr, 2011 1 commit
  37. 15 Dec, 2010 1 commit
  38. 04 May, 2010 1 commit
    • Ian Lynagh's avatar
      Fix build with GHC 6.10 · 63dde2e3
      Ian Lynagh authored
      In GHC 6.10, intersectionWith is (a -> b -> a) instead of (a -> b -> c),
      so we need to jump through some hoops to get the more general type.
      63dde2e3
  39. 03 May, 2010 1 commit
    • milan's avatar
      Replace FiniteMap and UniqFM with counterparts from containers. · 5ff8ce7f
      milan authored
      The original interfaces are kept. There is small performance improvement:
      - when compiling for five nofib, we get following speedups:
          Average                -----           -2.5%
          Average                -----           -0.6%
          Average                -----           -0.5%
          Average                -----           -5.5%
          Average                -----          -10.3%
      - when compiling HPC ten times, we get:
          switches                          oldmaps   newmaps
          -O -fasm                          117.402s  116.081s (98.87%)
          -O -fasm -fregs-graph             119.993s  118.735s (98.95%)
          -O -fasm -fregs-iterative         120.191s  118.607s (98.68%)
      5ff8ce7f
  40. 04 Dec, 2009 1 commit