| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
fix #18963
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Amazing nobody had reported the "Foldabla" typo. :-(
The Traversable docs got overhauled, leaving a stale
link in Foldable to a section that got replaced. Gave
the new section an anchor and updated the link.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While a *strict* (i.e. constant space) right-fold on lists is not
possible, the default `foldr'` is optimised for structures like
`Seq`, that support efficient access to the right-most elements.
The original default implementation seems to have a better
constant factor for lists, so we add a monomorphic implementation
in GHC.List.
Should this be re-exported from `Data.List`? That would be a
user-visible change if both `Data.Foldable` and `Data.List` are
imported unqualified...
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit bddecda1a4c96da21e3f5211743ce5e4c78793a2.
This implements the first step in the plan formulated in #20025 to
improve the communication and migration strategy for the proposed
changes to Data.List.
Requires changing the haddock submodule to update the test output.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This is a writeup of the state of play for better than linear `elem` via
a helper type class.
|
|
|
|
|
|
| |
- Add link to laws from the class head
- Simplify wording of left/right associativity intro paragraph
- Avoid needless mention of "endomorphisms"
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The sequencing of monadic effects in foldlM and foldrM was described as
respectively right-associative and left-associative, but this could be
confusing, as in essence we're just composing Kleisli arrows, whose
composition is simply associative.
What matters therefore is the order of sequencing of effects, which
can be described more clearly without dragging in associativity as
such.
This avoids describing these folds as being both left-to-right and
right-to-left depending on whether we're tracking effects or operator
application. The new text should be easier to understand.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- This allows specialized mconcat implementations an opportunity to combine
elements efficiently in a single pass.
- Inline the default implementation of `mconcat`, this
may result in list fusion.
- In Monoids with strict `mappend`, implement `mconcat` as a strict left fold:
* And (FiniteBits)
* Ior (FiniteBits)
* Xor (FiniteBits)
* Iff (FiniteBits)
* Max (Ord)
* Min (Ord)
* Sum (Num)
* Product (Num)
* (a -> m) (Monoid m)
- Delegate mconcat for WrappedMonoid to the underlying monoid.
Resolves: #17123
Per the discussion in !4890, we expect some stat changes:
* T17123(normal) run/alloc 403143160.0 4954736.0 -98.8% GOOD
This is the expected improvement in `fold` for a long list of
`Text` elements.
* T13056(optasm) ghc/alloc 381013328.0 447700520.0 +17.5% BAD
Here there's an extra simplifier run as a result of the new methods
of the Foldable instance for List. It looks benign. The test is
a micro benchmark that compiles just the derived foldable instances
for a pair of structures, a cost of this magnitude is not expected
to extend to more realistic programs.
* T9198(normal) ghc/alloc 504661992.0 541334168.0 +7.3% BAD
This test regressed from 8.10 and 9.0 back to exponential blowup.
This metric also fluctuates, for reasons not yet clear. The issue
here is the exponetial blowup, not this MR.
Metric Decrease:
T17123
Metric Increase:
T9198
T13056
|
|
|
|
|
| |
And though partially applied foldl' is now again inlined, #4301 has not
resurfaced, and appears to be resolved.
|
|
|
|
| |
Also added nested foldr example for `concat`.
|
| |
|
|
|
|
|
|
|
| |
- Remove GHC.OldList
- Remove Data.OldList
- compat-unqualified-imports is no-op
- update haddock submodule
|
|
|
|
| |
closes #19365
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The `Applicative` instance is the most important one (for
array/vector/sequence indexing purposes), but it deserves
all the usual ones.
T12545 does silly 1% wibbles both ways, it seems, maybe depending
on architecture.
Metric Increase:
T12545
Metric Decrease:
T12545
|
|
|
|
| |
With `-K500K` rts option stack overflows are more deterministic
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
- Further correction and reconcialation with new overview
of the existing synopses. Restored some "Tree" examples.
- New section on generative recursion via Church encoding
of lists.
|
|
|
|
|
|
|
|
|
|
|
| |
- Renamed new "update function" to "operator" from synopses
- More accurate divergence conditions.
- Fewer references to the Tree structure in examples, which
may not have the definition close-by in context in other
modules, e.g. Prelude.
- Improved description of foldlM and foldrM
- More detail on Tree instance construction
- Misc fixes
|
| |
|
|
|
|
| |
Also updated stale external URL in Traversable
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This PR concerns the following functions from `Data.Foldable`:
* minimum
* maximum
* sum
* product
* minimumBy
* maximumBy
- Default implementations of these functions now use `foldl'` or `foldMap'`.
- All have been marked with INLINEABLE to make room for further optimisations.
|
|
|
|
|
|
|
|
|
|
|
| |
* GHC.Core.Op => GHC.Core.Opt
* GHC.Core.Opt.Simplify.Driver => GHC.Core.Opt.Driver
* GHC.Core.Opt.Tidy => GHC.Core.Tidy
* GHC.Core.Opt.WorkWrap.Lib => GHC.Core.Opt.WorkWrap.Utils
As discussed in:
* https://mail.haskell.org/pipermail/ghc-devs/2020-April/018758.html
* https://gitlab.haskell.org/ghc/ghc/issues/13009#note_264650
|
|
|
|
| |
See #17929
|
| |
|
| |
|
| |
|
|
|
|
| |
E.g. use `\(\mathcal{O}(n^2)\)` instead of `/O(n^2)/`.
|
|
|
|
|
| |
This moves all URL references to Trac tickets to their corresponding
GitLab counterparts.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: hvr, bgamari, RyanGlScott
Reviewed By: RyanGlScott
Subscribers: RyanGlScott, rwbarton, carter
GHC Trac Issues: #15930
Differential Revision: https://phabricator.haskell.org/D5379
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Original proposal by Andrew Martin:
https://mail.haskell.org/pipermail/libraries/2018-June/028852.html
Reviewers: andrewthad, hvr, bgamari, alpmestan, tdammers
Reviewed By: bgamari, alpmestan, tdammers
Subscribers: alpmestan, rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4924
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Specifically:
* MonadFix
* MonadZip
* Data
* Foldable
* Traversable
* Eq1
* Ord1
* Read1
* Show1
* Generic
* Generic1
Fixes #15098.
Reviewers: RyanGlScott, hvr
Reviewed By: RyanGlScott
Subscribers: sjakobi, rwbarton, thomie, ekmett, carter
GHC Trac Issues: #15098
Differential Revision: https://phabricator.haskell.org/D4870
|
|
|
|
|
| |
This data type witnesses the lifting of a monoid into an applicative
pointwise.
|