How could I do a reload and then evaluate last expression inside GHCI
?
By last expression
I mean the last thing you typed in GHCI which was not a GHCI command. For example: 42
, "I am an expression"
, etc.
Example usage, let's say the reload and then evaluate last expression GHCI command is :x
:
>>> 42
42
>>> :x
42
>>>
In example above :x
does a reload and then evaluates 42
again.
Is there any GHCI
command that evaluates last expression?
If there was some GHCI command that evaluates last expression, let's say it was :last
, I could have done the reload and evaluate last expression by adding following to .ghci
:
:def re const $ return $ Data.List.unlines [":reload", ":last"]
In the guide it says that :
does Repeat the previous command.
https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html
But I tried that in cabal repl
and it did not work. Just prints a list of macros: