Is there a command in Haskell which displays (or get as a list of) all the user defined functions which have been loaded/defined in the GHCi? Thanks
Haskell : display/get list of all user defined functions
To see bindings you've made at the ghci prompt (e.g. with let
or <-
), try :show bindings
.
If you've loaded some modules, you can use :show modules
to get the names of loaded modules and then :browse ModuleName
to list everything in scope from that module.
Hi, I tried that but it did not work for me. I am using WinGHCi and I loaded the functions via the ':load' function as outlined in the post Haskell : loading ALL files in current directory path. However when I try ':show bindings' it just says 'it :: Int = 7' because I invoked 'addNumber2 3 4' last. Thanks –
Sullivan
I edited in instructions for what you do if there are modules. –
Thyroiditis
Hi, :browse requires knowledge of which module has been loaded. Is there a way of doing this without requiring knowledge of which modules have been loaded? (see also comment below). Thanks. –
Sullivan
I don't think so, unless you can parse the output of
:show modules
. –
Thyroiditis When in ghci, use :browse
or just :bro
after loading the file. You may also browse unloaded modules via :browse Foo.Bar.Baz
.
:br
now resolves to :break
, for browsing, you need :bro
. –
Carrera :dawg
should be a ghci synonym for :bro
–
Decimal Hi I tried this, but in WinGHCi ':browse' does nothing! I loaded the files as outlined in the post Haskell : loading ALL files in current directory path –
Sullivan
Did you try
:browse ModuleName
? –
Thyroiditis Ah I didnt realise that you have to specify the module name. But suppose I have scripts to load different modules. Then is there a way to see all the functions which have been loaded from the various modules, without requiring knowledge of which modules have been loaded? Thanks –
Sullivan
@Sullivan In ghci,
:browse
with no arguments shows the bindings defined in the currently loaded module(s). Perhaps you should upgrade from hugs. =) –
Chappelka © 2022 - 2024 — McMap. All rights reserved.