Reputation: 1307
In my cabal file I have a bunch of language extensions enabled. Let's say I have
Is there a way to start GHCi with these enabled automatically? instead of manually doing
ghci -XTemplateHaskell -XQuasiQuotes -XCPP
Upvotes: 1
Views: 882
Reputation: 1231
Specify the extensions in a pragma at the top of the source files:
{-# LANGUAGE TemplateHaskell, QuasiQuotes, CPP #-}
For ghc options that are not within the scope of the language pragma, you can also use the OPTIONS_GHC pragma (and you could write {-# OPTIONS_GHC -XTemplateHaskell -XQuasiQuotes -XCPP #-}
(note the lack of commas), but the language pragma is preferred where possible, as it is portable to other compilers that support the extensions).
Upvotes: -1
Reputation:
Yes, you can use the .ghci file. See section 2.9 in the GHC manual.
~/.ghci
:set -XTemplateHaskell -XQuasiQuotes -XCPP
Upvotes: 4