No fixity declaration for deepseq

Christiaan Baaij christiaan.baaij at gmail.com
Mon Apr 13 20:56:43 UTC 2020


Hello list,

Is the following behavior intended? or an oversight?

Prelude Control.DeepSeq> tail ((undefined :: ()) `seq` 1 : [])
*** Exception: Prelude.undefined
CallStack (from HasCallStack):
  error, called at libraries/base/GHC/Err.hs:80:14 in base:GHC.Err
  undefined, called at <interactive>:5:8 in interactive:Ghci2
Prelude Control.DeepSeq> tail ((undefined :: ()) `deepseq` 1 : [])
[]

If you're wondering what's happening, there is a (builtin) fixity
declaration for 'seq':
infixr `seq` 0

But there isn't one for `deepseq`.

So

undefined `seq` 1 : []

is parsed as

undefined `seq` (1 : [])

while

undefined `deepseq` 1 : []

is parsed as

(undefined `deepseq` 1) : []

In a real-life use-case, changing `seq` to `deepseq` actually resulted in a
(very unanticipated) space-leak for me. So again, is the lack of fixity
declaration for deepseq intentional? or an accidental omission?

Best regards,

Christiaan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20200413/2a0b0e5c/attachment.html>


More information about the Libraries mailing list