Loading GHC into GHCi (and ghcid)

Michael Sloan mgsloan at gmail.com
Thu Jun 28 05:48:11 UTC 2018


Wow!  This is an absolute game changer for me with regards to ghc
development.  My usual workflow on large haskell projects is to use
GHCI as much as possible for quick iterations.  I'm really glad
Csongor figured this out and that you sent an email about it.

I've been messing with this for a bit today, and after a few code
changes, I can to load GHCI into GHCI!!  For example, I can modify
"ghciWelcomeMessage", reload, and enter into the nested ghci:

λ :r
[491 of 492] Compiling GHCi.UI          ( ../ghc/GHCi/UI.hs, tmp/GHCi/UI.o )
Ok, 492 modules loaded.
λ :main -ignore-dot-ghci --interactive
GHCi inception, version 8.7.20180627: http://www.haskell.org/ghc/  :? for help
Prelude> unwords ["it", "works!"]
"it works!"
Prelude> :q
Leaving GHCi.
λ Prelude.unwords ["now,", "in", "outer", "GHCi"]
"now, in outer GHCi"

I will be opening up a PR soon that makes this convenient, once I've
polished it up.

-Michael
On Wed, May 30, 2018 at 1:43 PM Matthew Pickering
<matthewtpickering at gmail.com> wrote:
>
> Hi all,
>
> Csongor has informed me that he has worked out how to load GHC into
> GHCi which can then be used with ghcid for a more interactive
> development experience.
>
> 1. Put this .ghci file in compiler/
>
> https://gist.github.com/mpickering/73749e7783f40cc762fec171b879704c
>
> 2. Run "../inplace/bin/ghc-stage2 --interactive -odir tmp -hidir tmp"
> from inside compiler/
>
> It may take a while and require a little bit of memory but in the end
> all 500 or so modules will be loaded.
>
> It can also be used with ghcid.
>
> ghcid -c "../inplace/bin/ghc-stage2 --interactive -odir tmp -hidir tmp"
>
> Hopefully someone who has more RAM than I.
>
> Can anyone suggest the suitable place on the wiki for this information?
>
> Cheers,
>
> Matt
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


More information about the ghc-devs mailing list