3

我已经在两台电脑上试过了。这是我的步骤:

  1. 在cygwin上安装wget
  2. cabal install http-wget
  3. 升级我的 PATH 环境变量以包含 C:\cygwin\bin
  4. 打开 WinGHCi 并输入:

从提示:

GHCi, version 7.4.2: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :m + Network.HTTP.Wget
Prelude Network.HTTP.Wget> wget "http://www.google.com" [] []
Loading package bytestring-0.9.2.1 ... linking ... done.
Loading package Win32-2.2.2.0 ... linking ... done.
Loading package filepath-1.3.0.0 ... linking ... done.
Loading package old-locale-1.0.0.4 ... linking ... done.
Loading package old-time-1.1.0.0 ... linking ... done.
Loading package directory-1.1.0.2 ... linking ... done.
Loading package process-1.1.0.1 ... linking ... done.
Loading package failure-0.1.2 ... linking ... done.
Loading package transformers-0.2.2.0 ... linking ... done.
Loading package http-wget-0.6.2.3 ... linking ... done.

在这条线之后没有其他任何事情发生。命令未完成。它只是永远挂起。我对 Haskell 很陌生,不知道如何调试这个问题。

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.4.2

我已经在 cygwin 提示符下尝试了 wget 命令,它按预期工作。

这适用于 WinGHCi:

let getGoogle = do (_, Just hout, _, _) <- createProcess (proc "wget" ["-q", "www.google.com", "-O", "-"]){ std_out = CreatePipe }; hGetContents hout

我是从一位名叫 mcstar 的绅士那里从 IRC 那里得到的

4

0 回答 0