[GHC] #13280: Consider deriving more Foldable methods

GHC ghc-devs at haskell.org
Sun Apr 2 20:24:31 UTC 2017


#13280: Consider deriving more Foldable methods
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:  dfeuer
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:  deriving-perf
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by David Feuer <David.Feuer@…>):

 In [changeset:"bf5e0eab60a11d494671793740122e381a707c1a/ghc" bf5e0ea/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="bf5e0eab60a11d494671793740122e381a707c1a"
 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
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13280#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list