How to find type signatures of several imported methods in GHCI

I am using the library that I loaded into GHCI.

On behalf of the functions, it is not obvious to me which one I should use; I am sure that it exists and wants to see a list of signatures of the types of functions available to me. I do not know how to do that.

  • I can get a list of all the functions exported by the library by entering the module name and using the completion tab in GHCI.
  • Hoogle is useless to me because the library in question is not covered. However, a Hoogle style search would be helpful.
  • I know GHCI :t , but it only works for one function, and I don't want to do this for every single function that is exported by the library.
  • Running grep -R :: ./* or similar in the source directory can skip functions without explicit type signatures.
  • The library has Haddock documentation, but it contains about 1000 functions distributed among dozens of submodules, and it is tedious and error prone to manually search for all of them.

I am open to trying any method, but obviously prefer which one is simple, portable and repeatable.

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

+4
source share
1 answer

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

 > :browse Data.Tagged newtype Tagged sb = Tagged {unTagged :: b} asTaggedTypeOf :: s -> Tagged sb -> s retag :: Tagged sb -> Tagged tb tagSelf :: a -> Tagged aa untag :: Tagged sb -> b untagSelf :: Tagged aa -> a 
+5
source

Source: https://habr.com/ru/post/1343368/


All Articles