I loaded two modules (NecessaryModule1.hs and NecessaryModule2.hs as outlinked in Haskell : loading ALL files in current directory path). Now I want to unload NecessaryModule2.hs. I found an 'unload' function in System.Plugins.Load however but it did not work in WinGHCi. The error message I got was :
>unload NecessaryModule2
<interactive>:1:1: Not in scope: `unload'
<interactive>:1:8:
Not in scope: data constructor `NecessaryModule2'
I tried
import System.Plugins.Load
but that did not work. Is there a way to unload modules in the manner described above?
---------------------------------------------------------------------------------------
[RESPONSE TO Riccardo]
Hi Riccardo, I tried your suggestion but I could not get it to work in WinGHCi. I had a file NecessaryModule1.hs as follows :
module NecessaryModule1 where
addNumber1 :: Int -> Int -> Int
addNumber1 a b = a + b
I went to the location of the file via the ':cd' command, and then did :
> :module +NecessaryModule1
<no location info>:
Could not find module `NecessaryModule1':
it is not a module in the current program, or in any known package.
Is this correct? Thanks [EDIT : see below for correction]
---------------------------------------------------------------------------------------
[CORRECTION TO ABOVE]
Just to explain why the above is incorrect (as explained by Riccardo), what needs to be done is the following :
If we have a file NecessaryModule1.hs as follows :
--NecessaryModule1.hs
module NecessaryModule1 where
addNumber1 :: Int -> Int -> Int
addNumber1 a b = a + b
then we do :
> :load NecessaryModule1
[1 of 1] Compiling NecessaryModule1 ( NecessaryModule1.hs, interpreted )
Ok, modules loaded: NecessaryModule1.
> addNumber1 4 5
9
> :module -NecessaryModule1
> addNumber1 4 5
<interactive>:1:1: Not in scope: `addNumber1'