Maik Klein
Maik Klein

Reputation: 16158

How do I quickly inspect the source code of a function?

I am currently learning Haskell and I am using hoogle to quickly inspect the types of a function but it would be really neat to query the source code with an arbitrary function name.

For example in the haskell irc I can do

@src break
lambdabot> break p =  span (not . p)

Is there a terminal version of this? Or how do you quickly inspect the source code?

Upvotes: 2

Views: 238

Answers (2)

J. Abrahamson
J. Abrahamson

Reputation: 74374

There are a large number of things you can do to extend the GHCi prompt. This page talks about an old project called GHCi on Acid which suggests a lot of ideas. Generally, by editing your .ghcirc file you can add many command-line call-outs including to tools like commandline lambdabot/hoogle/pointfree.

Upvotes: 2

daniel gratzer
daniel gratzer

Reputation: 53901

A few options, one is to do

cabal install lambdabot

and then just run it on your terminal! This is probably the nicest option. Otherwise, you can run a local instance of Hoogle (again cabal install hoogle) and then view the attached source.

Upvotes: 2

Related Questions