[GHC] #9795: Debug.Trace.trace is too strict
GHC
ghc-devs at haskell.org
Thu Nov 13 09:37:27 UTC 2014
#9795: Debug.Trace.trace is too strict
-------------------------------------+-------------------------------------
Reporter: jcpetruzza | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: | Version: 7.8.3
libraries/base | Keywords:
Resolution: | Architecture: Unknown/Multiple
Operating System: | Difficulty: Unknown
Unknown/Multiple | Blocked By:
Type of failure: | Related Tickets:
None/Unknown |
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by jcpetruzza):
As another example of why `trace` shouldn't be strict, consider the
following:
{{{#!hs
f xs = trace (show xs) $ g 0 xs
where
g n [] = n
g n (x:xs) = g (n+1) xs
main
= print $ f [1..]
}}}
Because `trace` is strict, no output will be shown, which hides the fact
that `f` is actually being called but with invalid input.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9795#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list