The command (in GHCi)
:load abc
Loads the functions in the file abc (which must exist in the current directory path). How would I load all the files in the current directory path? Thanks
----------------------------------------------------------------------------------
[RESPONSE TO POST BELOW]
Hi Rotskoff, thanks I tried your suggestion but I could not get it to work, so I think I must have misunderstood something.
I created 3 files test.hs, test1.hs, and test2.hs as follows :
->
--test.hs
import NecessaryModule
->
--test1.hs
module NecessaryModule where
addNumber1 :: Int -> Int -> Int
addNumber1 a b = a + b
->
--test2.hs
module NecessaryModule where
addNumber2 :: Int -> Int -> Int
addNumber2 a b = a + b
Then when I did :
:load test
I got the error message :
test.hs:1:8:
Could not find module `NecessaryModule':
Use -v to see a list of the files searched for.
Thanks
---------------------------------------------------------------------------------
Thanks. This is what I did to get it to work (following Rotskoff's suggestion) :
->
--test.hs
import NecessaryModule1
import NecessaryModule2
->
--NecessaryModule1.hs
addNumber1 :: Int -> Int -> Int
addNumber1 a b = a + b
->
--NecessaryModule2.hs
addNumber2 :: Int -> Int -> Int
addNumber2 a b = a + b
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…