How can I show type of resulting expression in GHCi after each command? For example, instead of
ghci> "hello" ++ " world"
"hello world"
I want to see
ghci> "hello" ++ " world"
"hello world" :: String
or at least
ghci> "hello" ++ " world"
"hello world" :: [Char]
REPLs for other languages provide such behavior by default. But I can't find proper ghci option for such behavior. It also will be ok for me to just print type of it
after executing every command. But I didn't find a way how to call my commands after each ghci command. Well, sensible command: let ... = ...
doesn't have result (though it would be nice to print type of defined variable).
So what are the ways to show type of result automatically after each command?
Add :set +t
to .ghci
.
From documentation:
+t
Display the type of each variable bound after a statement is entered at the prompt.
If the statement is a single expression, then the only variable binding will be for
the variable ‘it’.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With