小编jav*_*ier的帖子

如果代码包含模块定义,为什么我无法用GHC编译?

我试图用ghc编译一个非常小的haskell代码:

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
Run Code Online (Sandbox Code Playgroud)

我用来编译的命令是:

ghc --make Comma.hs

我得到了这个答案:

[1/1]编译逗号(Comma.hs,Comma.o)

没有生成文件,也没有警告或错误消息.

如果我从代码正确编译的"模块逗号在哪里"注释:

[1/1]编译Main(Comma.hs,Comma.o)链接逗号...

我不明白发生了什么.我正在使用ghc 7,4,1(格拉斯哥Haskell编译器,版本7.4.1,由GHC版本7.4.1启动的第2阶段)和ubuntu linux.

我很感激,如果有人能说出为什么不用模块定义编译

haskell compiler-errors ghc

6
推荐指数
3
解决办法
2364
查看次数

标签 统计

compiler-errors ×1

ghc ×1

haskell ×1