[GHC] #13520: instance Alternative ZipList
GHC
ghc-devs at haskell.org
Thu Apr 26 18:46:10 UTC 2018
#13520: instance Alternative ZipList
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: feature request | Status: closed
Priority: normal | Milestone: 8.4.1
Component: libraries/base | Version: 8.0.1
Resolution: fixed | Keywords: newcomer
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D3416,
Wiki Page: | Phab:D4638
-------------------------------------+-------------------------------------
Changes (by dfeuer):
* differential: Phab:D3416 => Phab:D3416, Phab:D4638
Comment:
Zemyla, in an amazing coincidence of timing, I happened to write something
very similar to your first instance in Phab:D4638 just now. I think it
makes sense to use `foldr` to fold over the first argument. Unfortunately,
the `build` is a bit trickier, because it will end up copying the second
list if it doesn't fuse away. I'm not sure if it's possible to work around
that issue with `RULES`. Appends are generally handled by `augment`, but
that mechanism isn't powerful enough for what we're doing here because it
leaves no room to use an accumulated count in the tail. As for the hand-
unboxing, I'd only go for that if GHC proves incapable of unboxing on its
own; it's really quite good at that most of the time.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13520#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list