Download the new package in ghci using the stack

Is there a way to download a package using Stack in GHCI and play with it?

So, when ghci loads, we can import the modules and see its type signature, etc.

+5
source share
1 answer

For packages present in Stackage,

 $ stack ghci --package unix-time 

And this will give you a replacement with the unix-time package loaded into it:

 Run from outside a project, using implicit global project config Using resolver: lts-6.14 from implicit global project 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 

For multiple packages:

 $ 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 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 Ξ»> 
+12
source

Source: https://habr.com/ru/post/1257678/


All Articles