PSA / reminder: repl-based development is too hard

It would be great if we had a way to drop into a repl with access to all symbols, even unexported ones, by default, with zero friction.

Unfortunately, as far as I can tell, this still isn’t possible with cabal repl. Here’s an open issue with some details: https://github.com/haskell/cabal/issues/5374. It sounds like the core issue is in ghci's interface.

Even stack ghci, which somehow manages to get all modules’ exported symbols into one repl session, only seems to load one (random?) module’s unexported symbols.

I suppose I’m making this thread just to raise awareness about the issue :slight_smile:

4 Likes

Just to check if I understood this, if I:

  • cabal init --lib -m
  • add Foo.hs in src (and Foo in other-modules)

then I can

λ> Foo.foo
123

when Foo.foo is not part of the interface, am I wrong?

@f-a That’s right, but if you add a second module to your package (say Bar), then cabal repl will still only put either Foo or Bar in scope. I’m not sure how it picks which.

At that point you can add the other manually with e.g. :m +Bar, or :m + *Bar (with the asterisk) to get access to unexported symbols.

I think a better default would be as if :m + *Foo *Bar was run automatically.

1 Like

I think the current approach makes the most sense.

1 Like

Yep, this prevents me from switching back to Cabal from stack as well.

Perhaps a good compromise is to make .ghci files powerful enough to do this :m + <ALL>*. Then people can choose whether they want that or not.

1 Like