有没有办法在 GHCI 中查看模块中的函数列表? [英] Is there a way to see the list of functions in a module, in GHCI?
本文介绍了有没有办法在 GHCI 中查看模块中的函数列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发现在 Python 或 Common Lisp 中你可以在运行时列出库的内容很方便.Haskell 是否有同样的东西,特别是在 GHCI 提示中?
I find it handy in Python or Common Lisp that you can list a library's contents at runtime. Does Haskell have the same thing, in particular from a GHCI prompt?
推荐答案
GHCi 有一个 :browse
命令来列出模块的内容:
GHCi has a :browse
command to list the contents of modules:
Prelude> :browse Data.List
(\) :: (Eq a) => [a] -> [a] -> [a]
delete :: (Eq a) => a -> [a] -> [a]
deleteBy :: (a -> a -> Bool) -> a -> [a] -> [a]
deleteFirstsBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]
elemIndex :: (Eq a) => a -> [a] -> Maybe Int
...
Prelude> :help
...
:browse[!] [[*]<mod>] display the names defined by module <mod>
(!: more details; *: all top-level names)
...
这篇关于有没有办法在 GHCI 中查看模块中的函数列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文