- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我尝试 Haskell 类型并尝试获得 ->
类型时,结果出现了:
$ ghci
...
Prelude> :k (->)
(->) :: ?? -> ? -> *
Prelude>
而不是预期的* -> * -> *
。??
和 ?
是什么?它们是指具体类型还是“种类变量”?还是别的什么?
最佳答案
这些是 Haskell 类系统的 GHC 特定扩展。 Haskell 98 报告 specifies only a simple kind system :
... type expressions are classified into different kinds, which take one of two possible forms:
The symbol * represents the kind of all nullary type constructors. If k1 and k2 are kinds, then k1->k2 is the kind of types that take a type of kind k1 and return a type of kind k2.
GHC extends this system使用某种形式的子类型,允许 unboxed types ,并允许函数构造器在种类上具有多态性。格子GHC支持的种类有:
?
/\
/ \
?? (#)
/ \
* #
Where: * [LiftedTypeKind] means boxed type
# [UnliftedTypeKind] means unboxed type
(#) [UbxTupleKind] means unboxed tuple
?? [ArgTypeKind] is the lub of {*, #}
? [OpenTypeKind] means any type at all
定义于 ghc/compiler/types/Type.lhs
特别是:
> error :: forall a:?. String -> a
> (->) :: ?? -> ? -> *
> (\\(x::t) -> ...)
最后一个示例中的 t::??
(即不是未装箱的元组)。因此,引用 GHC 的话,“在种类级别上有一些子类型”。
对于感兴趣的人来说,GHC 还支持 GADT、新类型和类型系列中使用的强制类型和种类(“作为类型平等证据的类型级术语”,如 System Fc 所需要)。
关于Haskell 奇怪的种类 : Kind of (->) is ? ? ->? -> *,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3034264/
我正在为我的项目使用 Google Cloud Datastore(而非 NDB)。 python2.7 和 Django。 我想创建一个新模型,比如说 Tag 模型。 class Tag(db.Mo
我正在研究使用 monad 推导式来表示 SQL 查询,并生成适当的 SQL。乍一看,这不是问题,看起来很合适。但我必须限制类型,这些类型只能形成产品的单子(monad),而不是总和,而且我想不出一种
在Foldable文档,我看到以下实例: (Foldable f, Foldable g) => Foldable (Compose * * f g) 如果我查看 Compose 的定义,我看到它被声
给定一个团队->运动员关系并查询所有运动员。什么 我对fetch="Join"有误解吗?该映射是否应引起 通过联接加载团队?在对运动员进行迭代时 仍然懒惰地加载团队。 public class Ath
我才刚刚开始熟悉类型的概念,所以如果我没有很好地表达我的问题,请耐心等待...... 值有类型: 3 :: Int [1,2,3] :: [Int] ('c',True) :: (Char,Bool)
这里是我在 javascript 中的一个数组,效果很好! _rowData: [ { name: "Most Recent", view: "recentView" }, { nam
我正在尝试绘制 pandas Series用一条线。 这些线产生显示的输出和散点图。 import pandas as pd print(pd.__version__) ... print(type(
我正在使用 gcloud npm 模块。提前致谢。 我尝试了很多,但什么也没得到。 最佳答案 您需要对该实体进行查询并计算结果。 var query = ds.createQuery('EntityK
一些上下文 我对 libclang 不是很熟悉。我只是修改一个使用 the python bindings to libclang 的 vim 插件. 有一个 python 函数接收游标参数。当前 C
我有一个链接到 zlib v1.2.3 的程序,它出现以下错误: deflateEnd error 'no msg' kind: 'Z_DATA_ERROR': -3 该程序已成功处理许多要压缩的不同
我正在尝试通过遵循 the docs 来实现 log4rs .我的目标是将 info!("INFO") 的结果放入文件 requests.log,但出现错误: thread 'main' panick
Program type already present: org.apache.http.ContentTooLongException Message{kind=ERROR, text=Progr
当我执行 ng generate component faqs 时,我无法将新组件添加到我的 Nativescript 项目中它返回错误: Option "entryComponent" is dep
我是一名优秀的程序员,十分优秀!