Going through the source code for the prelude brings up weirdness

后端 未结 2 1724
暗喜
暗喜 2021-02-19 05:52

I was looking for the definition of seq and came across this weirdness. Why do all these functions have the same/similar definitions?

seq :: a ->         


        
2条回答
  •  轮回少年
    2021-02-19 06:34

    These definitions are a ruse: they're provided primitively by the GHC runtime. It turns out that the infinite loop let x = x in x can be given any type, so it's as good a ruse definition as any.

提交回复
热议问题