为GHCI添加依赖

时间:2015-07-25 18:27:15

标签: haskell ghci

我可以在GHCI中包含依赖项。

如果运行cabal添加到.cabal文件

build-depends:       base >=4.7 && <4.8,http-conduit-downloader

可以http-conduit-downloader加入GHCI吗?

更新:

运行命令:

c:\Users\Adrian\Google Drive\SparkSetup>cabal sandbox init
Writing a default package environment file to c:\Users\Adrian\Google
Drive\SparkSetup\cabal.sandbox.config
Using an existing sandbox located at C:\Users\Adrian\Google
Drive\SparkSetup\.cabal-sandbox

c:\Users\Adrian\Google Drive\SparkSetup>cabal install --only-dependencies
cabal: SparkSetup.cabal:19: Construct not supported at this position: F 19
"main-is" "SparkSetup.hs\nbuild-depends: base >=4.7 &&
<4.8,http-conduit-downloader\ndefault-language: Haskell2010"

c:\Users\Adrian\Google Drive\SparkSetup>cabal repl
Package has never been configured. Configuring with default flags. If this
fails, please run configure manually.
cabal: SparkSetup.cabal:19: Construct not supported at this position: F 19
"main-is" "SparkSetup.hs\nbuild-depends: base >=4.7 &&
<4.8,http-conduit-downloader\ndefault-language: Haskell2010"

cabal repl无法启动repl?

更新2:

c:\Users\Adrian\Google Drive\SparkSetup>cabal configure
cabal: SparkSetup.cabal:19: Construct not supported at this position: F 19
"main-is" "SparkSetup.hs\nbuild-depends: base >=4.7 &&
<4.8,http-conduit-downloader\ndefault-language: Haskell2010"

更新3:

cabal和ghci版本:

C:\Users\Adrian\Google Drive\SparkSetup>cabal --version
cabal-install version 1.18.0.5
using version 1.18.1.3 of the Cabal library

C:\Users\Adrian\Google Drive\SparkSetup>ghci
GHCi, version 7.8.3: 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>

更新4:

SparkSetup.cabal:

-- Initial SparkSetup.cabal generated by cabal init.  For further 
-- documentation, see http://haskell.org/cabal/users-guide/

name:                SparkSetup
version:             0.1.0.0
-- synopsis:            
-- description:         
license:             GPL-2
license-file:        LICENSE
author:              USER
maintainer:          USER.COM
-- copyright:           
-- category:            
build-type:          Simple
-- extra-source-files:  
cabal-version:       >=1.10

executable SparkSetup
main-is: SparkSetup.hs             
  -- other-modules:       
  -- other-extensions:    
  build-depends:       base >=4.7 && <4.8,http-conduit-downloader
  -- hs-source-dirs:      
  default-language:    Haskell2010

第19行:main-is: SparkSetup.hs

SparkSetup.hs存在于与SparkSetup.cabal相同的目录中,SparkSetup.hs内容为:main = putStrLn "Hello, World!"

这不正确吗?

更新5:

更新了.cabal文件:

-- Initial SparkSetup.cabal generated by cabal init.  For further 
-- documentation, see http://haskell.org/cabal/users-guide/

name:                SparkSetup
version:             0.1.0.0
-- synopsis:            
-- description:         
license:             GPL-2
license-file:        LICENSE
author:              USER
maintainer:          USER.COM
-- copyright:           
-- category:            
build-type:          Simple
-- extra-source-files:  
cabal-version:       >=1.10

executable SparkSetup
  main-is: SparkSetup.hs
  -- other-modules:    
  -- other-extensions:    
  build-depends:       base >=4.7 && <4.8,http-conduit-downloader
  -- hs-source-dirs:      
  default-language:    Haskell2010

似乎是一个缩进问题(\ n也可能导致问题)

但现在我跑的时候:

c:\Users\Adrian\Google Drive\SparkSetup>cabal install
Resolving dependencies...
Notice: installing into a sandbox located at C:\Users\Adrian\Google
Drive\SparkSetup\.cabal-sandbox
Configuring network-2.6.2.1...
Failed to install network-2.6.2.1
Last 10 lines of the build log ( C:\Users\Adrian\Google Drive\SparkSetup\.cabal-
sandbox\logs\network-2.6.2.1.log ):
[1 of 1] Compiling Main             ( C:\Users\Adrian\AppData\Local\Temp\network
-2.6.2.1-10212\network-2.6.2.1\dist\dist-sandbox-8472864c\setup\setup.hs, C:\Use
rs\Adrian\AppData\Local\Temp\network-2.6.2.1-10212\network-2.6.2.1\dist\dist-san
dbox-8472864c\setup\Main.o )
Linking C:\Users\Adrian\AppData\Local\Temp\network-2.6.2.1-10212\network-2.6.2.1
\dist/dist-sandbox-8472864c\setup\setup.exe ...
Configuring network-2.6.2.1...
setup.exe: The package has a './configure' script. This requires a Unix
compatibility toolchain such as MinGW+MSYS or Cygwin.
cabal: Error: some packages failed to install:
HsOpenSSL-0.11.1.1 depends on network-2.6.2.1 which failed to install.
SparkSetup-0.1.0.0 depends on network-2.6.2.1 which failed to install.
connection-0.2.5 depends on network-2.6.2.1 which failed to install.
http-client-0.4.18.1 depends on network-2.6.2.1 which failed to install.
http-client-tls-0.2.2 depends on network-2.6.2.1 which failed to install.
http-conduit-2.1.7.1 depends on network-2.6.2.1 which failed to install.
http-conduit-downloader-1.0.25 depends on network-2.6.2.1 which failed to
install.
network-2.6.2.1 failed during the configure step. The exception was:
ExitFailure 1
socks-0.5.4 depends on network-2.6.2.1 which failed to install.
streaming-commons-0.1.12.1 depends on network-2.6.2.1 which failed to install.
tls-1.3.1 depends on network-2.6.2.1 which failed to install.
x509-validation-1.6.0 depends on network-2.6.2.1 which failed to install.

似乎http-conduit-downloader包还存在问题?

0 个答案:

没有答案