I was thinking that maybe you could make a custom Prelude
that loads those modules automatically, but custom preludes also seem to break cabal repl
according to my limited testing.
Edit: thanks to this stackoverflow post:
I figured out that you can make the custom prelude work if you put it into a different sublibrary. That also fixes the .ghci
module loading problem. So you can do something like this:
-- .ghci
import YourModule
-- your-package.cabal
[...]
library demo
build-depends: your-package
$ cabal repl demo
You can even give your script a different name if you put this in your .cabal
file:
library demo
build-depends: your-package
ghc-options: -ghci-script demo-script