Windows Haskell Parsec编译错误

Windows Haskell Parsec编译错误,windows,haskell,parsec,Windows,Haskell,Parsec,我已经通过预构建的安装程序v6.8.2安装了Haskell 尝试使用GHC编译此示例文件时 module Main where import Text.ParserCombinators.Parsec import System.Environment main :: IO () main = do args <- getArgs putStrLn ("Hello") 我已经通过阴谋集团安装了Parsec 有人知道哪里出了问题吗?根据(第1.2.1节使用GHC编译)

我已经通过预构建的安装程序v6.8.2安装了Haskell

尝试使用GHC编译此示例文件时

module Main where
import Text.ParserCombinators.Parsec
import System.Environment

main :: IO ()
main = do args <- getArgs
          putStrLn ("Hello")
我已经通过阴谋集团安装了Parsec

有人知道哪里出了问题吗?

根据(第1.2.1节使用GHC编译),您应该这样做:

将文件链接在一起时, 你需要告诉GHC在哪里可以找到它 库(-L)和链接到 Parsec库也是(-l):
ghc-o myprogram myfile1.o myfile2.o-Lc:\parsec-lparsec


在Haskell编译器上可能会有所帮助。

尝试
ghc--make-o read.hs
。GHC将处理链接器依赖关系。

我将提出另一种方法来实现这一点

ghc -package parsec -o read read.hs
来自ghc文档

-package P

This option causes the installed package P to be exposed. The package P can be 
specified in full with its version number (e.g. network-1.0) or the version number 
can be omitted if there is only one version of the package installed. If there are 
multiple versions of P installed, then all other versions will become hidden.

The -package P option also causes package P to be linked into the resulting 
executable or shared object. Whether a packages' library is linked statically or 
dynamically is controlled by the flag pair -static/-dynamic.

请参见

不完全是我想要的,但无论如何,感谢您的尝试;)
-package P

This option causes the installed package P to be exposed. The package P can be 
specified in full with its version number (e.g. network-1.0) or the version number 
can be omitted if there is only one version of the package installed. If there are 
multiple versions of P installed, then all other versions will become hidden.

The -package P option also causes package P to be linked into the resulting 
executable or shared object. Whether a packages' library is linked statically or 
dynamically is controlled by the flag pair -static/-dynamic.