导入作为 Haskell 中的运算符的类型族
Import a type family that is an operator in Haskell
GHC.TypeNats
导出以下签名的类型系列:
type family (m :: Nat) + (n :: Nat) :: Nat
如何显式导入它? import GHC.TypeNats((+))
不起作用,因为它说 GHC.TypeNats
不导出 (+)
...
当我隐式导入整个模块时,一切都编译正常,但这真的不是我想要在我的代码中拥有的。
我正在使用 GHC 8.6.5
来自the manual:
There is now some potential ambiguity in import and export lists; for example if you write import M( (+) )
do you mean the function (+)
or the type constructor (+)
? The default is the former, but with ExplicitNamespaces
(which is implied by TypeOperators
) GHC allows you to specify the latter by preceding it with the keyword type, thus:
import M( type (+) )
GHC.TypeNats
导出以下签名的类型系列:
type family (m :: Nat) + (n :: Nat) :: Nat
如何显式导入它? import GHC.TypeNats((+))
不起作用,因为它说 GHC.TypeNats
不导出 (+)
...
当我隐式导入整个模块时,一切都编译正常,但这真的不是我想要在我的代码中拥有的。
我正在使用 GHC 8.6.5
来自the manual:
There is now some potential ambiguity in import and export lists; for example if you write
import M( (+) )
do you mean the function(+)
or the type constructor(+)
? The default is the former, but withExplicitNamespaces
(which is implied byTypeOperators
) GHC allows you to specify the latter by preceding it with the keyword type, thus:import M( type (+) )