使用ghci来查找类型 [英] Using ghci to find type

查看:127
本文介绍了使用ghci来查找类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  let x = 7 + 2 

当我在ghci中做一些简单的操作时, / code>

我希望ghci给出x保持的类型的响应,如:

  x ::整数

当我运行ghci,我不明白上面这行。如何获得该响应?

解决方案

自动显示类型使用:set + t

 μ> :set + t 
μ>让x = 7 + 2
x :: Integer
μ>


When I do something simple in ghci, like the following:

let x = 7 + 2

I expect ghci to give a response of the type that x holds, like:

x :: Integer

When I run ghci, I do not get that the above line. How do I get that response?

解决方案

To show types automatically use :set +t:

μ> :set +t
μ> let x = 7 + 2
x :: Integer
μ>

这篇关于使用ghci来查找类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆