简体   繁体   中英

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.

{--
 - 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.

How can I resolve this discrepancy between ghc from the command line and the ghci 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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