How to create source file for haskell (ghci)

I created a file in a text editor on mac called: 1stfunctionite.hs

using the function:

doubleX x = x + x 

      

Then they saved it in my documents. Then I went to a terminal called ghci

and entered

:l 1stfunctionite

      

In the prelude, however, an error appeared:

target ‘1stfunctionite is not a module name or a source file 

      

How do I create a source file with this function inside, so I can use it in the terminal in prelude?

+3


source to share


1 answer


You must be in the same directory for it to work, just execute :cd <your directory>

in ghci and you should be fine.



+2


source







All Articles