[commit: ghc] master: Derive the definition of null (bf5e0ea)
git at git.haskell.org
git at git.haskell.org
Sun Apr 2 20:24:37 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/bf5e0eab60a11d494671793740122e381a707c1a/ghc
>---------------------------------------------------------------
commit bf5e0eab60a11d494671793740122e381a707c1a
Author: David Feuer <david.feuer at gmail.com>
Date: Sun Apr 2 16:20:20 2017 -0400
Derive the definition of null
We can sometimes produce much better code by deriving the
definition of `null` rather than using the default. For example,
given
data SnocList a = Lin | Snoc (SnocList a) a
the default definition of `null` will walk the whole list, but of
course we can stop as soon as we see `Snoc`. Similarly, if a
constructor contains some other `Foldable` type, we want to use its
`null` rather than folding over the structure.
Partially fixes Trac #13280
Reviewers: austin, bgamari, RyanGlScott
Reviewed By: RyanGlScott
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3402
>---------------------------------------------------------------
bf5e0eab60a11d494671793740122e381a707c1a
compiler/prelude/PrelNames.hs | 5 +-
compiler/typecheck/TcGenFunctor.hs | 132 ++++++++++++++++++++-
docs/users_guide/8.4.1-notes.rst | 50 ++++----
docs/users_guide/glasgow_exts.rst | 45 +++++--
.../tests/perf/should_run/DeriveNullTermination.hs | 17 +++
.../should_run/DeriveNullTermination.stdout} | 0
testsuite/tests/perf/should_run/all.T | 7 +-
7 files changed, 216 insertions(+), 40 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc bf5e0eab60a11d494671793740122e381a707c1a
More information about the ghc-commits
mailing list