Search code examples
haskellghci

How can I pass command line arguments to GHCi


How can I pass command line arguments to ghci in the same way as doing the below (within the GHCi prompt):

:set args abc xyz

So something like ghci Main.hs -- abc xyz?


Solution

  • You can create a .ghci file with

    :set args abc xyz
    

    Which will be executed when executing ghci Main.hs.