How can I view the source definitions in ghci (with lambdabot 2.5 GHCi on Acid) of functions/classes etc defined in my project or cabal dependencies? For example suppose I have :
module Main where
import System.Random
gen = (random (mkStdGen 0)) :: (Bool,StdGen)
myadd :: Int -> Int
myadd x = 2 * x
main = do
print "finished"
Then I can get information on myadd
and random
but I cannot print the source. Here is what I can do in ghci (with lambdabot) :
*Main GOA> :src foldr
foldr f z [] = z
foldr f z (x:xs) = f x (foldr f z xs)
*Main GOA> :i myadd
myadd :: Int -> Int -- Defined at test.hs:7:1
*Main GOA> :src myadd
Source not found. I don't think I can be your friend on Facebook anymore.
*Main GOA> :i random
class Random a where
...
random :: RandomGen g => g -> (a, g)
...
-- Defined in ‘System.Random’
*Main GOA> :src random
Source not found. Listen, broccoli brains, I don't have time to listen to this trash.
lambdabot seems to be able to print the definitions of foldr
but not functions defined in
the project (myadd
) or functions in the cabal depedencies (random
).
Is it possible for me to print out the definitions of things like myadd
and random
, using some feature of lambdabot? I know you can use Hoogle for random
but I want to specifically know if there is any way to use ghci or lambdabot to print out the source definitions.
[EDIT]
Since posting I discovered Emacs/Inferior Haskell processes and some of the functionality theirin seems to achieve some of the above.