View non-exposed library functions while developing in Haskell

前端 未结 1 451
天涯浪人
天涯浪人 2021-01-12 09:03

I made a mistake in another question that could have been solved by viewing

:t myfunctionofinterest

for a function I was using in a librar

相关标签:
1条回答
  • 2021-01-12 09:23

    Quoting the GHCi docs:

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

    • :module supports the * modifier on modules, which opens the full top-level scope of a module, rather than just its exports.

    The additional * makes GHCi load the bytecode version of the module. This will not be as performant, but you'll get access to unexported bindings.

    Example:

    λ> :m *MyLib
    λ> :t myfunctionofinterest
    

    If you get

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

    you may have to do :load first (the advice about :add doesn't always do the trick):

    λ> :l *MyLib
    λ> :m *MyLib
    λ> :t myfunctionofinterest
    
    0 讨论(0)
提交回复
热议问题