cabal -线程选项不起作用
cabal -threaded options not working
我正在试用 Haskell 和 Cabal。我用这个配置文件创建了一个项目。
executable dictionary
main-is: Main.hs
-- other-modules:
-- other-extensions:
ghc-options: -threaded -rtsopts
build-depends: base >=4.9 && <4.10, http-streams, io-streams, bytestring, HsOpenSSL
-- hs-source-dirs:
default-language: Haskell2010
我正在尝试发送获取请求。
main :: IO ()
main = withOpenSSL $ do
putStrLn "Type in a word"
word <- getLine
let word1 = filter isAlphaNum $ (words word) !! 0
putStrLn word1
ctx <- baselineContextSSL
c <- openConnectionSSL ctx url 443
let q = buildRequest1 $ do
http GET $ (C.pack $ "/api/v1/entries/en/" ++ word1)
setAccept (C.pack "text/html")
setHeader (C.pack "app_id") app_id
setHeader (C.pack "app_key") apli_id
sendRequest c q emptyBody
receiveResponse c (\p i -> do
S.putStrLn $ getStatusMessage p
xm <- Streams.read i
case xm of
Just x -> S.putStr x
Nothing -> putStrLn "")
closeConnection c
我尝试 运行 cabal 运行 但结果仍然是:
Type in a word
go
go
dictionary: user error (RTS doesn't support multiple OS threads (use ghc -threaded when linking))
我正在使用 macOS X siera
哦,我只需要 运行:
cabal clean
和
cabal run
再次使用新标志进行编译。
我正在试用 Haskell 和 Cabal。我用这个配置文件创建了一个项目。
executable dictionary
main-is: Main.hs
-- other-modules:
-- other-extensions:
ghc-options: -threaded -rtsopts
build-depends: base >=4.9 && <4.10, http-streams, io-streams, bytestring, HsOpenSSL
-- hs-source-dirs:
default-language: Haskell2010
我正在尝试发送获取请求。
main :: IO ()
main = withOpenSSL $ do
putStrLn "Type in a word"
word <- getLine
let word1 = filter isAlphaNum $ (words word) !! 0
putStrLn word1
ctx <- baselineContextSSL
c <- openConnectionSSL ctx url 443
let q = buildRequest1 $ do
http GET $ (C.pack $ "/api/v1/entries/en/" ++ word1)
setAccept (C.pack "text/html")
setHeader (C.pack "app_id") app_id
setHeader (C.pack "app_key") apli_id
sendRequest c q emptyBody
receiveResponse c (\p i -> do
S.putStrLn $ getStatusMessage p
xm <- Streams.read i
case xm of
Just x -> S.putStr x
Nothing -> putStrLn "")
closeConnection c
我尝试 运行 cabal 运行 但结果仍然是:
Type in a word
go
go
dictionary: user error (RTS doesn't support multiple OS threads (use ghc -threaded when linking))
我正在使用 macOS X siera
哦,我只需要 运行:
cabal clean
和
cabal run
再次使用新标志进行编译。