Understanding the different behavior of thunks when GHCi let bindings are involved

后端 未结 1 1727
陌清茗
陌清茗 2021-02-01 13:24

I\'ve been playing with some examples from Simon Marlow\'s book about parallel and concurrent programming in Haskell and stumbled across an interesting behavior that I don\'t re

相关标签:
1条回答
  • 2021-02-01 13:55

    Because (,) is a constructor, the difference makes no difference to Haskell's semantics (:sprint gives access to internal thunk implementation details so doesn't count.) So this is a question of which optimizations and trade-offs GHC does when compiling (x,x) in different positions. Someone else may know the precise reason in these cases.

    0 讨论(0)
提交回复
热议问题