Ezra
Ezra

Reputation: 7702

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'm open 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?

Upvotes: 4

Views: 297

Answers (1)

Thomas M. DuBuisson
Thomas M. DuBuisson

Reputation: 64750

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

Upvotes: 5

Related Questions