在评论时
another question
我发现引用透明性有明显的突破。在GHCI中:
> f g h = g `seq` h `seq` \x -> g (h x)
> seq (f undefined id) ()
()
> seq (undefined `seq` id `seq` \x -> undefined (id x)) ()
*** Exception: Prelude.undefined
CallStack (from HasCallStack):
error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
undefined, called at <interactive>:3:14 in interactive:Ghci9
为什么第一个不是底部的?(GHC 8.2.2如果重要的话——我现在没有在这台机器上安装任何其他版本。)