2016-10-04 53 views

回答

11

對於目前在Stackage包,

$ stack ghci --package unix-time 

這會給你一個REPL在它裝載在封裝unix-time

Run from outside a project, using implicit global project config 
Using resolver: lts-6.14 from implicit global project's config file: /home/sibi/.stack/global-project/stack.yaml 
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help 
λ> import Data.UnixTime 
λ> :t getUnixTime 
getUnixTime :: IO UnixTime 

對於多個軟件包:

$ stack ghci --package unix-time --package download 
Run from outside a project, using implicit global project config 
Using resolver: lts-6.14 from implicit global project's config file: /home/sibi/.stack/global-project/stack.yaml 
tagsoup-0.13.10: using precompiled package 
xml-1.3.14: using precompiled package 
time-locale-compat-0.1.1.3: using precompiled package 
feed-0.3.11.1: download 
feed-0.3.11.1: configure 
feed-0.3.11.1: build 
feed-0.3.11.1: copy/register 
download-0.3.2.4: download 
download-0.3.2.4: configure 
download-0.3.2.4: build 
download-0.3.2.4: copy/register 
Completed 5 action(s). 
Configuring GHCi with the following packages: 
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help 
Ok, modules loaded: none. 
λ> import Network.Download 
λ> 
+0

其實你不需要指定'--package'選項。你可以只寫'stack ghci lens mtl' – Shersh

+0

@Shersh謝謝,更新了答案。 – Sibi

+0

我不能在不指定'--package'選項的情況下加載'matrix'包。我必須像'stack ghci --package matrix' fyi一樣正確寫入。 – Redu