Is it possible to add comments to a .ghci
file?
E.g.
:set +r # https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#faq-and-things-to-watch-out-for
This would be useful both for documenting and for toggling behaviour.
Sure, they use the same --
as normal Haskell comments. In fact, this is what my .ghci
file looks like, with lots of stuff commented-out:
-- :def hoogle \x -> return $ ":!hoogle \"" ++ x ++ "\""
-- :def doc \x -> return $ ":!hoogle --info \"" ++ x ++ "\""
:set -XTypeOperators
:set -XTupleSections
:set -XFlexibleContexts
:set -XGADTs
-- Pretty printing of it
-- :set -package ghci-pretty
-- import IPPrint.Colored
-- :set -interactive-print=IPPrint.Colored.cpprint
...
(Not sure why I did that BTW, I normally just delete stuff I don't use and restore it through version control if necessary.)
To be precise (as the comments remind me to be), .ghci
comments are lines starting with --
. Unlike haskell comments, they can not be appended to a line containing code, nor can the space after the --
be omitted.