haskell repl getting the type of nested functions

57 views Asked by At

I'm just asking if you can see the type of nested functions using the repl in haskell?

When using a language server, you can easily see the type of a nested function such as:

foo = bar where 
  bar = id

of course, you get:

bar :: a -> a
defined in ....

I assume that this should be possible in the repl but, I haven't yet found a way to do this.

ghci> let foo = bar where bar = id
ghci> :t bar

<interactive>:1:1: error: Variable not in scope: bar

(which makes sense since it's not a top level function)

0

There are 0 answers