.: createDirectory: 无效参数 (Invalid argument)
.: createDirectory: invalid argument (Invalid argument)
我已经习惯了 Haskell 没有 ghci 帮助的开发,即一起使用 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 方面却很少。
跳过 --make
标志。 运行 只是 ghc test.hs
.
我已经习惯了 Haskell 没有 ghci 帮助的开发,即一起使用 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 方面却很少。
跳过 --make
标志。 运行 只是 ghc test.hs
.