我寫的(經)上(圍)一個簡單的Hello World應用程序。它可以在Ubuntu Linux中正常工作,就像更復雜的應用程序一樣。但我甚至無法讓這個Hello World應用程序在Windows中運行。我在Windows 7 Home Premium SP1 32位上使用Haskell平臺(安裝文件2012.2.0.0)。故障運行經,上圍,在Windows
這是代碼(在Linux下正常工作):
{-# LANGUAGE OverloadedStrings #-}
import Network
import Network.Wai
import Network.HTTP.Types (status200)
import Network.Wai.Handler.Warp (run)
-------------------------------------------------------------------------------
application = \_-> return $ responseLBS status200 [("Content-Type", "text/plain")]
"Hello World"
main = withSocketsDo $ do run 3000 application
這些都是在加載代碼,並運行GHCI消息(主):
Prelude> :l wai_hello_world.hs
[1 of 1] Compiling Main (wai_hello_world.hs, interpreted)
Ok, modules loaded: Main.
*Main> main
Loading package bytestring-0.9.2.1 ... linking ... done.
Loading package [ **edited**: blah blah blah - other packages - removed for readability]
Loading package warp-1.3.2 ... linking ... done.
加載代碼後,網絡服務器似乎沒有運行。
我想我可能會運行到一些常見的問題 - 如果是的話,請讓我知道。
預先感謝所有的反饋。
(更新:在下面的回答指出,這些錯誤僅僅是由於按Ctrl-C行動,殺害運行,而不是圍/翹曲的問題的意外行爲的一部分。)
如果我按Ctrl-C幾次打出來,我得到這些消息,或 一些品種其中:
NIenttweorrrku.pStoecdk.e t.ace*Main> p: failed (No error) user error (accept: can't perform accept on socket ((AF_INET,Stream,0)) in status Closed) user error (accept: can't perform accept on socket ((AF_INET,Stream,0)) in status Closed) *Main> *Main> user error (accept: can't perform accept on socket ((AF_INE,:Sream,0)) in status Closed) q Leaving GHCi.
@andrewc感謝編輯。 – jerng