。:createDirectory:无效参数(无效参数)

时间:2015-04-23 15:33:07

标签: haskell ghc

我已经习惯了没有ghci帮助的Haskell开发,即使用cabal和ghc。

我正在尝试编写一个非常简单的haskell文件来编译但是我得到一个没有意义的奇怪错误,至少在表面上没有。

type Date = (String, String)
type Temperature = (String, Int)

data TemperatureInfo = Temp Date Temperature
                       deriving (Show)

myTemp = Temp ("date:","2015-02-28T20:16:12+00:00") ("Temperature", 0)


main :: IO ()
main = print myTemp

错误:

Bradley$ ghc --make test.hs
         [1 of 1] Compiling Main             ( test.hs, test.o )
         .: createDirectory: invalid argument (Invalid argument)

我不确定这是否有用,但如果我从打印功能中删除参数,则错误消失并在下面给出错误(如预期的那样)。不确定这是否具有指示性。

[1 of 1] Compiling Main             ( test.hs, test.o )

test.hs:12:8:
    Couldn't match expected type ‘IO ()’ with actual type ‘a0 -> IO ()’
    Probable cause: ‘print’ is applied to too few arguments
    In the expression: print
    In an equation for ‘main’: main = print

有趣的是,因为我将这个文件存储在usb棒上并cd到目录并在那里编译文件,因为我正在写这个问题,我把它移到我的桌面并尝试再次编译它的工作原理!

Bradley$ runhaskell test.hs
         Temp ("date:","2015-02-28T20:16:12+00:00") ("Temperature",0)

我觉得我花了95%的时间试图让我的haskell开发环境正常工作,5%实际编码,有没有人知道或者有过任何经验,为什么我遇到这些类型的问题?对于初学者和专家来说似乎有很多文档,但在正确设置haskell platform / cabal / ghc方面却很少。

1 个答案:

答案 0 :(得分:1)

跳过--make标记。只运行ghc test.hs

相关问题