gpt4 book ai didi

typeclass - 是否存在 Show Int 类型的值?

转载 作者:行者123 更新时间:2023-12-02 23:59:07 24 4
gpt4 key购买 nike

根据 idris Show Int 是一种类型。

*main> :t Show Int
Show Int : Type

具有该类型的值的示例是什么?

*main> :t ?
? : Show Int

我可以用什么替换来获得这种行为?

我在这里找到了问题的答案:In Idris, is "Eq a" a type, and can I supply a value for it?

最佳答案

这是 Show 类型类的单个实例

Show String where
show cs = strCons '"' (showLitString (cast cs) "\"")

Prelude/Show.idr 中定义,其中还定义了类型类

关于typeclass - 是否存在 Show Int 类型的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46126230/

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