No fixity declaration for deepseq

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

No fixity declaration for deepseq

Christiaan Baaij
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



_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: No fixity declaration for deepseq

chessai .
This seems unintended. Maybe others are wise to the contrary? Perhaps a patch should be made.

Thanks

On Mon, Apr 13, 2020, 1:57 PM Christiaan Baaij <[hidden email]> wrote:
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


_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries