gpt4 book ai didi

haskell - ScopedTypeVariables 的缺点

转载 作者:行者123 更新时间:2023-12-04 03:08:07 28 4
gpt4 key购买 nike

ScopedTypeVariables 的缺点是什么? ,如果有的话?为什么默认不开启?它会导致更糟糕的推理吗?是否存在失败的边缘情况?在 GHC 中实现是否困难得多?

最佳答案

这也是因为它改变了程序的语义(结合其他扩展)。考虑

{-# LANGUAGE RankNTypes #-}
foo :: forall a . (a -> a) -> (a -> a)
foo = bar
where
bar :: a -> a
bar = id

它编译得很好,但使用 ScopedTypeVariables它甚至无法编译。

关于haskell - ScopedTypeVariables 的缺点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18852341/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com