'Running a haskell program in the repl after changing the file
I have a haskell program that defines
module Lib
( someFunc
) where
someFunc :: IO ()
someFunc = do
print "Hello world"
Opening the REPL with stack loads this lib into the context.
*Main Lib Paths_hs> someFunc
"Hello world"
After changing the function, writing the file, and executing the function i'm presented with the same result
someFunc :: IO ()
someFunc = do
print "Bye bye"
*Main Lib Paths_hs> someFunc
"Hello world"
But i'm expecting the function someFunc
to return the new value i've declared "Bye bye"
.
I've tried running stack build
but to no avail.Now, I can re open the REPL, and have the new function, but I don't want to lose my current history. Is there anyway I can load my new compiled program into the current REPL, or load the active sessions history into a new REPL
Solution 1:[1]
According to the docs, you can use the :reload
directive (or :r
shortly).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |