[英]"Could not load module ‘Control.Monad.State’ It is a member of the hidden package ‘mtl-2.2.2’" error upon using runhaskell
I tried running runhaskell InterpretSpec.hs
, which then pulls from Interpret.hs
this:我尝试运行
runhaskell InterpretSpec.hs
,然后从Interpret.hs
提取:
-- Look at how testing is set up in FORTH project and emulate here
-- Make sure you unit test every function you write
import Test.Hspec
import Test.QuickCheck
import Control.Exception (evaluate)
import Pascal.Data
import Pascal.Interpret
import Control.Monad.State
import Data.Map (Map)
import qualified Data.Map as Map
main :: IO ()
main = hspec $ do
let startscope=SymbolTable{variables=Map.empty, global=Map.empty, loop=["notrunning"], functions=Map.empty, procedures=Map.empty, returnstring="", inmain=True}
describe "eval" $ do
it "takes the square root" $ do
evalState (eval(Op1 "sqrt" (Real1 25.0))) startscope `shouldBe` (5.0)
it "takes the cos" $ do
evalState (eval(Op1 "cos" (Real1 0.0))) startscope `shouldBe` (1.0)
it "takes the sin" $ do
evalState (eval(Op1 "sin" (Real1 0.0))) startscope `shouldBe` (0.0)
it "takes the sin" $ do
evalState (eval(Op1 "sin" (Real1 0.0))) startscope `shouldBe` (0.0)
it "takes the sin" $ do
evalState (eval(Op1 "sin" (Real1 0.0))) startscope `shouldBe` (0.0)
mtl is included in the .cabal
file, and I've referenced the suggested solutions at: mtl 包含在
.cabal
文件中,我在以下位置引用了建议的解决方案:
and和
and neither solves the issue.并且都不能解决问题。
On its own, runhaskell
doesn't account for your cabal environment.就其本身而言,
runhaskell
不考虑您的阴谋集团环境。 You have to use it through cabal exec
:您必须通过
cabal exec
使用它:
cabal exec runhaskell InterpretSpec.hs
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.