简体   繁体   English

HUnit 没有在 Mac 上导入

[英]HUnit not importing on Mac

On a fresh install of Haskell Platform for Max OSX, the following code fails on import Test.HUnit when run using the runghc interpreter.在为 Max OSX 全新安装 Haskell 平台时,以下代码在使用runghc解释器运行时import Test.HUnit失败。

{--
 - Save this file as Main.hs and run with % runghc Main.hs
 -}

module Main where

import Test.HUnit

derp = test [ "a silly test" ~: 'a' ~=? 'a' ]
tests = TestList [ derp ]

main::IO()
main = (runTestTT tests) >>= (\x -> putStrLn $ show x)

However, when using ghci, doing a simple import Test.HUnit works just fine.然而,当使用 ghci 时,做一个简单的import Test.HUnit就可以了。

How can I resolve this discrepancy between ghc from the command line and the ghci REPL?如何解决命令行中的ghcghci REPL 之间的这种差异?

Reboot the machine.重新启动机器。 Not sure whether it's paths not containing the right directories or something else, but a fresh start after install seems to have resolved it.不确定它的路径是否不包含正确的目录或其他内容,但安装后重新开始似乎已经解决了它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM