I'm trying to build a function in Haskell. I created a plain text file with the following function:
doubleme x = x + x
I saved it under baby.txt.
I navigated to the file from the command line, then I did the following from the command line:
ghci
Prelude> :l baby
it returned:
target ‘baby’ is not a module name or a source file
I was wondering what I'm doing wrong and how to make the function compile?
You should name the file with .hs extension. and loading it using command :l in ghci
Prelude> :l baby.hs
[1 of 1] Compiling Main ( baby.hs, interpreted )
Ok, one module loaded.
*Main>
*Main>
*Main>
*Main> :t doubleme
doubleme :: Num a => a -> a
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With