View unpublished library functions when developing in Haskell

I made a mistake in another question that could be solved by looking at

:t myfunctionofinterest 

for the function that I used in the library.

However, when I am at the root of my project and run

 $ stack ghci 

And my Main.hs has:

 import MyLib 

And my module:

 module MyLib { bunchOfFunctions -- but not myfunctionofinterest } where import SomeDB.ModuleThatExposes -- myfunctionofinterest myfunc :: IO () myfunc = do myfunctionofinterest abc -- place where I misuse myfunctionofinterest and could have used :t on it to see it had 3 args 

I can鈥檛 :t myfunctioninterinterest basically, since it is not displayed, and Import MyLib.myfunctionofinterest clearly help, as it was defined in the import. While I know that I could expose it and then check it out :a to compile and then edit the lib to hide it again, is there something that allows it faster and faster?

It seems to be a common template. What do you do when you need to check the type of what is used in the library during development?

+7
haskell development-environment
source share
1 answer

Citation GHCi Documents :

The :module command provides a way to do two things that cannot be done with regular import declarations:

  • :module supports the * modifier on modules, which opens the full volume of the top level of the module, and not just its export.

The optional * forces GHCi to load the bytecode version of the module. It will not be as productive, but you will get access to unclosed bindings.

Example:

 位> :m *MyLib 位> :t myfunctionofinterest 

If you get

 module 'MyLib' is not interpreted; try ':add *MyLib' first 

you may need to first :load (tip :add doesn't always do the trick):

 位> :l *MyLib 位> :m *MyLib 位> :t myfunctionofinterest 
+6
source share

All Articles