When I write a simple script and pass it to runhaskell, it works fine, but not when I add shebang and try to execute it directly. script:
import Data.List (intercalate)
main :: IO ()
main = putStrLn $ intercalate " " $ map show [1..10]
If I try $ runhaskell count.hsbash printing 1 2 3 4 5 6 7 8 9 10as expected, but if I try ./count.hs, I get the following error:
./count.hs: line 3: syntax error near unexpected token `('
./count.hs: line 3: `import Data.List (intercalate)'
Is this error a source in bash or runhaskell? And how to fix it?
source
share