haskell - [安全] 标记在 ghci 中是什么意思?

标签 haskell ghci

Prelude Data.Void> :info Void
data Void       -- Defined in `Data.Void'
instance [safe] Eq Void -- Defined in `Data.Void'
instance [safe] Ord Void -- Defined in `Data.Void'
instance [safe] Read Void -- Defined in `Data.Void'
instance [safe] Show Void -- Defined in `Data.Void'

[安全] 是什么意思?

最佳答案

它只是意味着数据类型是在使用安全扩展定义的模块中定义的。您可以找到扩展程序的详细信息in the user guide .

事实上,您可以通过使用 Safe 定义一个模块来自己测试。扩大:

{-#LANGUAGE Safe#-}

data Test = Test deriving (Eq, Show)

然后在 ghci 中试用:
λ> :i Test
data Test = Test    
instance [safe] Eq Test 
instance [safe] Show Test 

但请注意,在当前的 GHC (7.10.2) 中,由于 this ghc bug,安全扩展不能依赖于信任保证。 .

关于haskell - [安全] 标记在 ghci 中是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33464076/

相关文章:

haskell - cons操作cons元素是从右到左吗?

haskell - 如何让 ghci 查看我从 cabal 安装的软件包?

haskell 解析 n+k 模式的模式错误

git - Haskell 堆栈和版本控制

具有多个参数和类型问题的 Haskell 映射

haskell - 简单的 Haskell 实例问题

haskell - 查找树的深度 haskell

haskell - 比较 Haskell 中的不同类型

haskell - 使用 lambdabot 在 ghci 中打印函数/类的定义

haskell - "Implicit Configurations"纸张的代码