1. 15 Oct, 2018 1 commit
  2. 17 Sep, 2018 1 commit
    • Sebastian Graf's avatar
      Make sure forM_ and related functions fuse cleanly · e655aac1
      Sebastian Graf authored and Krzysztof Gogolewski's avatar Krzysztof Gogolewski committed
      Summary:
      It was revealed in #8763 that it's hard to come up with a list fusion
      helper for `efdtIntFB` that doesn't duplicated occurrences of `c`,
      which is crucial in guaranteeing that it is inlined.
      
      Not inlining `c` led to spoiled join points, in turn leading to unnecessary
      heap allocation. This patch tackles the problem from a different angle:
      Fixing all consumers instead of the less often used producer
      `efdtIntFB` by inserting an INLINE pragma in the appropriate places.
      See https://ghc.haskell.org/trac/ghc/ticket/8763#comment:76 and the new
      Note [List fusion and continuations in 'c'].
      
      A quick run of NoFib revealed no regression or improvements whatsoever.
      
      Reviewers: hvr, bgamari, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, rwbarton, carter
      
      GHC Trac Issues: #8763
      
      Differential Revision: https://phabricator.haskell.org/D5131
      e655aac1
  3. 21 Aug, 2018 1 commit
    • Alec Theriault's avatar
      Fix ambiguous/out-of-scope Haddock identifiers · ddffa0cd
      Alec Theriault authored and Ben Gamari's avatar Ben Gamari committed
      This drastically cuts down on the number of Haddock warnings when making
      docs for `base`.  Plus this means more actual links end up in the docs!
      Also fixed other small mostly markup issues in the documentation along
      the way.
      
      This is a docs-only change.
      
      Reviewers: hvr, bgamari, thomie
      
      Reviewed By: thomie
      
      Subscribers: thomie, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5055
      ddffa0cd
  4. 16 Jul, 2018 1 commit
  5. 20 Jun, 2018 1 commit
  6. 27 May, 2018 1 commit
  7. 19 May, 2018 1 commit
  8. 14 May, 2018 1 commit
    • David Feuer's avatar
      Improve some Foldable methods for NonEmpty · b7139869
      David Feuer authored and Ben Gamari's avatar Ben Gamari committed
      * `length` is improved by using the default definition,
        while `foldr1` is improved by using a custom one.
      
      * Several methods had useless lazy pattern matches
        (i.e., the functions were actually strict in those arguments).
        Remove `~`s to clarify.
      
      Reviewers: hvr, bgamari, mpickering, nomeata
      
      Reviewed By: bgamari
      
      Subscribers: ygale, rwbarton, thomie, carter
      
      GHC Trac Issues: #15131
      
      Differential Revision: https://phabricator.haskell.org/D4677
      b7139869
  9. 02 Mar, 2018 1 commit
  10. 04 Sep, 2017 1 commit
  11. 22 Aug, 2017 1 commit
  12. 17 Aug, 2017 1 commit
  13. 04 Mar, 2017 1 commit
  14. 19 Jan, 2017 1 commit
  15. 05 Jan, 2017 1 commit
  16. 18 Jun, 2016 1 commit
    • Ryan Scott's avatar
      Add Bifoldable and Bitraversable to base · 270d545d
      Ryan Scott authored and Ben Gamari's avatar Ben Gamari committed
      This adds `Data.Bifoldable` and `Data.Bitraversable` from the
      `bifunctors` package to `base`, completing the migration started in
      D336.  This is fairly straightforward, although there were a suprising
      amount of reinternal organization in `base` that was needed for this to
      happen:
      
      * `Data.Foldable`, `Data.Traversable`, `Data.Bifoldable`, and
        `Data.Bitraversable` share some nonexported datatypes (e.g., `StateL`,
        `StateR`, `Min`, `Max`, etc.) to implement some instances. To avoid
        code duplication, I migrated this internal code to a new hidden
        module, `Data.Functor.Utils` (better naming suggestions welcome).
      
      * `Data.Traversable` and `Data.Bitraversable` also make use of an
        identity newtype, so I modified them to use
        `Data.Functor.Identity.Identity`. This has a ripple effect on several
        other modules, since I had to move instances around in order to avoid
        dependency cycles.
      
      Fixes #10448.
      
      Reviewers: ekmett, hvr, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2284
      
      GHC Trac Issues: #9682, #10448
      270d545d
  17. 06 Jun, 2016 1 commit
  18. 29 Feb, 2016 1 commit
    • Ryan Scott's avatar
      Missing Proxy instances, make U1 instance more Proxy-like · 171d95df
      Ryan Scott authored and Ben Gamari's avatar Ben Gamari committed
      This accomplishes three things:
      
      * Adds missing `Alternative`, `MonadPlus`, and `MonadZip` instances for
        `Proxy`
      * Adds a missing `MonadPlus` instance for `U1`
      * Changes several existing `U1` instances to use lazy pattern-matching,
        exactly how `Proxy` does it (in case we ever replace `U1` with
        `Proxy`). This is technically a breaking change (albeit an extremely
        minor one).
      
      Test Plan: ./validate
      
      Reviewers: austin, ekmett, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1962
      
      GHC Trac Issues: #11650
      171d95df
  19. 25 Feb, 2016 1 commit
    • Ryan Scott's avatar
      Add more type class instances for GHC.Generics · 673efccb
      Ryan Scott authored and Ben Gamari's avatar Ben Gamari committed
      GHC.Generics provides several representation data types that have
      obvious instances of various type classes in base, along with various
      other types of meta-data (such as associativity and fixity).
      Specifically, instances have been added for the following type classes
      (where possible):
      
          - Applicative
          - Data
          - Functor
          - Monad
          - MonadFix
          - MonadPlus
          - MonadZip
          - Foldable
          - Traversable
          - Enum
          - Bounded
          - Ix
          - Generic1
      
      Thanks to ocharles for starting this!
      
      Test Plan: Validate
      
      Reviewers: ekmett, austin, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: RyanGlScott, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1937
      
      GHC Trac Issues: #9043
      673efccb
  20. 21 Jan, 2016 1 commit
  21. 23 Dec, 2015 1 commit
    • Eric Seidel's avatar
      Allow CallStacks to be frozen · 380b25ea
      Eric Seidel authored and Ben Gamari's avatar Ben Gamari committed
      This introduces "freezing," an operation which prevents further
      locations from being appended to a CallStack.  Library authors may want
      to prevent CallStacks from exposing implementation details, as a matter
      of hygiene. For example, in
      
      ```
      head [] = error "head: empty list"
      
      ghci> head []
      *** Exception: head: empty list
      CallStack (from implicit params):
        error, called at ...
      ```
      
      including the call-site of `error` in `head` is not strictly necessary
      as the error message already specifies clearly where the error came
      from.
      
      So we add a function `freezeCallStack` that wraps an existing CallStack,
      preventing further call-sites from being pushed onto it. In other words,
      
      ```
      pushCallStack callSite (freezeCallStack callStack) = freezeCallStack callStack
      ```
      
      Now we can define `head` to not produce a CallStack at all
      
      ```
      head [] =
        let ?callStack = freezeCallStack emptyCallStack
        in error "head: empty list"
      
      ghci> head []
      *** Exception: head: empty list
      CallStack (from implicit params):
        error, called at ...
      ```
      
      ---
      
      1. We add the `freezeCallStack` and `emptyCallStack` and update the
         definition of `CallStack` to support this functionality.
      
      2. We add `errorWithoutStackTrace`, a variant of `error` that does not
         produce a stack trace, using this feature. I think this is a sensible
         wrapper function to provide in case users want it.
      
      3. We replace uses of `error` in base with `errorWithoutStackTrace`. The
         rationale is that base does not export any functions that use CallStacks
         (except for `error` and `undefined`) so there's no way for the stack
         traces (from Implicit CallStacks) to include user-defined functions.
         They'll only contain the call to `error` itself. As base already has a
         good habit of providing useful error messages that name the triggering
         function, the stack trace really just adds noise to the error. (I don't
         have a strong opinion on whether we should include this third commit,
         but the change was very mechanical so I thought I'd include it anyway in
         case there's interest)
      
      4. Updates tests in `array` and `stm` submodules
      
      Test Plan: ./validate, new test is T11049
      
      Reviewers: simonpj, nomeata, goldfire, austin, hvr, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Projects: #ghc
      
      Differential Revision: https://phabricator.haskell.org/D1628
      
      GHC Trac Issues: #11049
      380b25ea
  22. 05 Aug, 2015 1 commit
  23. 03 Mar, 2015 1 commit
    • Oleg Grenrus's avatar
      Add various instances to newtypes in Data.Monoid · 4e6bcc2c
      Oleg Grenrus authored
      Summary:
      Add Functor instances for Dual, Sum and Product
      Add Foldable instances for Dual, Sum and Product
      Add Traversable instances for Dual, Sum and Product
      Add Foldable and Traversable instances for First and Last
      Add Applicative, Monad instances to Dual, Sum, Product
      Add MonadFix to Data.Monoid wrappers
      Derive Data for Identity
      Add Data instances to Data.Monoid wrappers
      Add Data (Alt f a) instance
      
      Reviewers: ekmett, dfeuer, hvr, austin
      
      Reviewed By: dfeuer, austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D673
      
      GHC Trac Issues: #10107
      4e6bcc2c
  24. 18 Feb, 2015 1 commit
  25. 05 Feb, 2015 1 commit
    • David Feuer's avatar
      Eta-expand argument to foldr in mapM_ for [] · 7cf87fc6
      David Feuer authored
      Summary:
      This improves performance, at least sometimes--the previous
      implementation can be worse than the version in base 4.7. I
      have not had the time to run benchmarks and such, but `mapM`
      already does this.
      
      Also, inline `mapM_`, like `mapM`.
      
      Reviewers: hvr, nomeata, ekmett, austin
      
      Reviewed By: ekmett, austin
      
      Subscribers: thomie
      
      Projects: #ghc
      
      Differential Revision: https://phabricator.haskell.org/D632
      
      GHC Trac Issues: #10034
      7cf87fc6
  26. 06 Jan, 2015 1 commit
  27. 06 Dec, 2014 1 commit
  28. 21 Nov, 2014 1 commit
  29. 13 Nov, 2014 1 commit
    • David Feuer's avatar
      Improve `Foldable` instance for `Array` · 212a3505
      David Feuer authored and Herbert Valerio Riedel's avatar Herbert Valerio Riedel committed
      Previously, `Array`s were simply converted to lists, and the list
      methods used. That works acceptably well for `foldr` and `foldr1`, but
      not so sensibly for most other things. Left folds ended up "twisted" the
      way they are for lists, leading to surprising performance
      characteristics.
      
      Moreover, this implements `length` and `null` so they check the array
      size directly.
      
      Finally, a test is added to the testsuite ensuring the overridden
      `Foldable` methods agree with their expected default semantics.
      
      Addresses #9763
      
      Reviewed By: hvr, austin
      
      Differential Revision: https://phabricator.haskell.org/D459
      212a3505
  30. 11 Nov, 2014 1 commit
  31. 05 Nov, 2014 1 commit
  32. 04 Nov, 2014 2 commits
  33. 28 Oct, 2014 1 commit
    • David Feuer's avatar
      base: Refactor/clean-up *List modules · 75979f36
      David Feuer authored and Herbert Valerio Riedel's avatar Herbert Valerio Riedel committed
      This gets rid of all hand-unboxing in `GHC.List` and moves `Foldable`
      requirements from `Data.OldList` into `GHC.List` (preparatory work for
      addressing #9716).  Specifically, this moves the definition of
      `maximum`, `minimum`, `foldl'`, `foldl1`, `foldl1'`, `sum`, and
      `product` into `GHC.List` (which now needs to import `GHC.Num`)
      
      Make `take`, `drop`, `length`, and `!!` generally saner (see also #9510)
      
      Performance overall seems minimally affected. Some things go up; some
      things go down; nothing moves horribly much. The code is much easier to
      read.
      
      Differential Revision: https://phabricator.haskell.org/D380
      75979f36
  34. 28 Sep, 2014 1 commit
  35. 24 Sep, 2014 1 commit
  36. 21 Sep, 2014 1 commit
    • Herbert Valerio Riedel's avatar
      Generalise Data.List/Control.Monad to Foldable/Traversable · 1f7f46f9
      Herbert Valerio Riedel authored
      This flips the switch and replaces the entities in
      `Data.List`/`Control.Monad` conflicting with
      `Data.{Foldable,Traversable}` with re-exports of the more general
      versions.
      
      As of this commit, the code below (which is also added as a test-case)
      compiles w/o error.
      
          module XPrelude (module X) where
      
          import Control.Monad     as X
          import Data.Foldable     as X
          import Data.List         as X
          import Data.Monoid       as X
          import Data.Traversable  as X
          import Prelude           as X
      
      This addresses #9568
      
      Reviewed By: ekmett, austin
      
      Differential Revision: https://phabricator.haskell.org/D235
      1f7f46f9
  37. 20 Sep, 2014 2 commits
  38. 19 Sep, 2014 1 commit