Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you pre-load a module when invoking `cabal repl`?

Tags:

haskell

cabal

Is there a way to have a module automatically load when cabal repl shows the ready prompt? I'd like to shortcut the following workflow with some command line options or something equivalent for cabal repl:

cabal repl
ghci> :m + Note.Query
... now I do stuff with functions in the Note.Query module
like image 819
dan Avatar asked Feb 12 '23 19:02

dan


1 Answers

You can put the command :m + Note.Query in a file called .ghci. If there is a file called .ghci in the current directory, then it will be run when you invoke GHCi. If there is no .ghci file in the current directory, but there is one in your home directory, then that will be run. This allows you to have project-specific .ghci files.

like image 175
mhwombat Avatar answered Feb 22 '23 07:02

mhwombat