Adding packages from within ghci session

Hello I've been exploring some code via ghci, and I've found myself in this loop: - write some code - figure out I need another package (e.g. mtl for runReaderT) - add package to cabal specification - reload stack ghci - Ctrl+R all the statements to replay the session so far Is there a way to speed up the loop, e.g. via loading packages directly from ghci or saving/replaying a session? Cheers, Simon

I think you can do :"set -package foo".
Does that do what you want?
On 19 Jan 2018 1:49 pm, "Simon Hafner"
Hello
I've been exploring some code via ghci, and I've found myself in this loop:
- write some code - figure out I need another package (e.g. mtl for runReaderT) - add package to cabal specification - reload stack ghci - Ctrl+R all the statements to replay the session so far
Is there a way to speed up the loop, e.g. via loading packages directly from ghci or saving/replaying a session?
Cheers, Simon _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.

I've tested this out but can't get it to work. Seems like ghci can
only see packages that existed when it was loaded. Would be a good
thing to add to ghci or intero.
If this was possible, then you could have a ghci macro that ran `stack
build foo`, and, once it completed did `:set -package foo`.
On Fri, Jan 19, 2018 at 7:16 AM, Oliver Charles
I think you can do :"set -package foo".
Does that do what you want?
On 19 Jan 2018 1:49 pm, "Simon Hafner"
wrote: Hello
I've been exploring some code via ghci, and I've found myself in this loop:
- write some code - figure out I need another package (e.g. mtl for runReaderT) - add package to cabal specification - reload stack ghci - Ctrl+R all the statements to replay the session so far
Is there a way to speed up the loop, e.g. via loading packages directly from ghci or saving/replaying a session?
Cheers, Simon _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
_______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.

Oh, I just remembered - I do this with `cabal repl`. So what I'm doing is
usually starting with a small set of `build-depends` entries, and then
changing my .cabal file and extending my REPL. I'm not installing new
packages though. I agree, this would be a nice feature.
On Sat, Jan 20, 2018 at 4:38 AM, Michael Sloan
I've tested this out but can't get it to work. Seems like ghci can only see packages that existed when it was loaded. Would be a good thing to add to ghci or intero.
If this was possible, then you could have a ghci macro that ran `stack build foo`, and, once it completed did `:set -package foo`.
On Fri, Jan 19, 2018 at 7:16 AM, Oliver Charles
wrote: I think you can do :"set -package foo".
Does that do what you want?
On 19 Jan 2018 1:49 pm, "Simon Hafner"
wrote: Hello
I've been exploring some code via ghci, and I've found myself in this loop:
- write some code - figure out I need another package (e.g. mtl for runReaderT) - add package to cabal specification - reload stack ghci - Ctrl+R all the statements to replay the session so far
Is there a way to speed up the loop, e.g. via loading packages directly from ghci or saving/replaying a session?
Cheers, Simon _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
_______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
participants (3)
-
Michael Sloan
-
Oliver Charles
-
Simon Hafner