小编pat*_*ckm的帖子

Haskell - 什么使'主'独特?

使用此代码:

main :: FilePath -> FilePath -> IO ()
main wrPath rdPath = do x <- readFile rdPath
                        writeFile wrPath x
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

Couldn't match expected type 'IO t0'
            with actual type 'FilePath -> FilePath -> IO()
Run Code Online (Sandbox Code Playgroud)

但是当我将'main'的名称更改为其他名称时,文件会正确编译.

什么是主要的独特之处,为什么它的类型必须是IO t0

io haskell types program-entry-point compiler-errors

7
推荐指数
2
解决办法
1409
查看次数