显示GHCi中每个结果的类型

She*_*rsh 1 haskell types ghci

如何在每个命令后显示GHCi中结果表达式的类型?例如,而不是

ghci> "hello" ++ " world"
"hello world"
Run Code Online (Sandbox Code Playgroud)

我想看看

ghci> "hello" ++ " world"
"hello world" :: String
Run Code Online (Sandbox Code Playgroud)

或至少

ghci> "hello" ++ " world"
"hello world" :: [Char]
Run Code Online (Sandbox Code Playgroud)

默认情况下,其他语言的REPL提供此类行为.但是我找不到适合这种行为的ghci选项.我也可以it在执行每个命令后打印类型.但是我没有找到在每个ghci命令之后如何调用命令的方法.嗯,明智的命令:let ... = ...没有结果(虽然打印定义变量的类型会很好).那么在每个命令之后自动显示结果类型的方法是什么?

ДМИ*_*КОВ 6

添加:set +t.ghci.

来自文档:

+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’.
Run Code Online (Sandbox Code Playgroud)