Is there a way to see the list of functions in a module, in GHCI?

后端 未结 2 1923
野趣味
野趣味 2020-12-01 13:47

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?

2条回答
  •  温柔的废话
    2020-12-01 14:15

    Depending on exactly what information you intend to extract... If your version of GHCi supports tab-completion, then you can use that to list all of a namespace's available functions:

    Prelude> :m +Data.List
    Prelude Data.List> Data.List.
    Display all 109 possibilities? (y or n) 
    Prelude Data.List> Data.List.un
    Data.List.unfoldr  Data.List.unlines  Data.List.unzip3   Data.List.unzip6   
    Data.List.union    Data.List.unwords  Data.List.unzip4   Data.List.unzip7   
    Data.List.unionBy  Data.List.unzip    Data.List.unzip5   
    

提交回复
热议问题