I'am trying to compile a very small haskell code with ghc:
module Comma where
import System.IO
main = do
contents <- getContents
putStr (comma contents)
comma input =
let allLines = lines input
addcomma [x] = x
addcomma (x:xs) = x ++ "," ++ (addcomma xs)
result = addcomma allLines
in result
The command i'm using to compile is :
ghc --make Comma.hs
And i'm getting this answer:
[1 of 1] Compiling Comma ( Comma.hs, Comma.o )
No file is generated, and there is no warning or errors messages.
If i comment the "module Comma where" line from code it compiles correctly:
[1 of 1] Compiling Main ( Comma.hs, Comma.o ) Linking Comma ...
I don't understand what is happening. I'm using ghc 7,4,1 (Glasgow Haskell Compiler, Version 7.4.1, stage 2 booted by GHC version 7.4.1) and ubuntu linux.
I appreciate if anyone could tell why doesn't compile with the module definition
-main-is
flag,ghc -main-is Comma Comma
(you don't need--make
with ghc since 7.0). – Daniel Fischermain = interact $ intercalate "," . lines
– chirlu