在 GHCi 中,为什么函数箭头 `:kind (->)` 的类型包含问号 `(->) :: ?? -> ? -> *`?

发布于 2024-10-23 23:00:26 字数 536 浏览 4 评论 0原文

可能的重复:
Haskell 怪异种类:(->) 的种类是 ?? -> ? -> *

在 GHCi(版本 7.0.2)中,如果我询问函数类型的种类,结果有问号:

Prelude> :kind (->)
(->) :: ?? -> ? -> *

Why does the kind include Question Marks without just asterisks * -> *-> *?问号是什么意思?为什么其他类型只使用星号?

Prelude> :kind (,)
(,) :: * -> * -> *

Possible Duplicate:
Haskell Weird Kinds: Kind of (->) is ?? -> ? -> *

In GHCi (version 7.0.2), if I ask for the kind of the function type, the result has question marks:

Prelude> :kind (->)
(->) :: ?? -> ? -> *

Why does the kind include question marks instead of just asterisks * -> * -> *? What do the question marks mean? Why do other types just use asterisks?

Prelude> :kind (,)
(,) :: * -> * -> *

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野却迷人 2024-10-30 23:00:26

??? 类型指的是 GHC 扩展,特别是未装箱的类型。 http://hackage.haskell.org/trac/ghc/wiki/IntermediateTypes有一个图表显示扩展类型 ? (所有可能的类型)、# (未装箱类型)、?? (装箱或普通未装箱)之间的关系types — “#* 的最小上界”), (#) (未装箱的元组,只能少量使用的上下文)。 (标准类型 * 指的是普通的盒装类型。)

The ? and ?? kinds refer to GHC extensions, specifically unboxed types. http://hackage.haskell.org/trac/ghc/wiki/IntermediateTypes has a diagram showing relationships between the extended kinds ? (all possible types), # (unboxed types), ?? (boxed or normal unboxed types — "least upper bound of # and *"), (#) (unboxed tuples, which can only be used in a small number of contexts). (The standard kind * refers to normal boxed types.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文