开发者

How to find type signatures of multiple imported methods in GHCI

I'm using a library, which I've loaded into GHCI.

From the names of the functions is not obvious to me which one I should be using; I'm sure it exists, and want to see a list of type signatures of the functions available to me. I don't know how to do this.

  • I can get a list of all the functions exported by the library by typing the module name and using tab-completing in GHCI.
  • Hoogle is useless to me, because the library in question isn't covered. Hoogle-style of searching would be useful, though.
  • I know of GHCI's :t, but it only seems to work for a single function, and I don't want to do this for every single function that is being exported by the library.
  • Running grep -R :: ./* or similar over the source directory may omit functions without explicit type signatures.
  • The library has Haddock documentation, but it has around 1000 functions spread out amongst dozens of submodules, and it's tedious and error prone to manually search them all.

I'm ope开发者_C百科n to try any method, but obviously prefer what's simple, portable, and repeatable.

Is there a way to find the type signatures of all exported functions in a library? Or to find out which functions have a type signature that includes a certain type?


just use :browse Module.Name and you'll see all the values exported by the module:

> :browse Data.Tagged
newtype Tagged s b = Tagged {unTagged :: b}
asTaggedTypeOf :: s -> Tagged s b -> s
retag :: Tagged s b -> Tagged t b
tagSelf :: a -> Tagged a a
untag :: Tagged s b -> b
untagSelf :: Tagged a a -> a
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜