[GHC] #9495: Do What I Mean RULES for foldr2 look shady
GHC
ghc-devs at haskell.org
Mon Aug 25 08:09:23 UTC 2014
#9495: Do What I Mean RULES for foldr2 look shady
-------------------------------------+-------------------------------------
Reporter: dfeuer | Owner:
Type: bug | Status: new
Priority: highest | Milestone: 7.8.4
Component: | Version: 7.8.3
libraries/base | Keywords:
Resolution: | Architecture: Unknown/Multiple
Operating System: | Difficulty: Unknown
Unknown/Multiple | Blocked By:
Type of failure: Runtime | Related Tickets:
crash |
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
To broaden this a bit, it is worth remembering that ''the main
`foldr/build` rule itself is unsound in the presence of `seq`''. See, for
example, the
[http://www.haskell.org/haskellwiki/Correctness_of_short_cut_fusion#In_the_presence_of_seq
Haskell wiki page].
This is not nice. The "right" solution is for `seq` to be an operation of
a type class, something that was the case in Haskell originally, and then
changed after ''extensive'' debate on the Haskell committee.
So currently we are stuck in the unsatisfactory situation that certain
optimisations, which have a generally very beneficial effect on
performance, can change termination behaviour. Eta reduction/expansion is
another.
In that general context I don't have a strong opinion about the `foldr2`
question. I'd consult the Core Libraries Committee.
Simon
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9495#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list