Friday 24 February 2017

[Haskell-Cabal] pass specific options to build tools

Cabal provides options on command line to pass options to specific tools. For example, if we want to pass debug option to happy.

$ cabal build --happy-option=-d
 References:
$ cabal build --help

    --with-PROG=PATH    give the path to PROG
    --PROG-option=OPT   give an extra option to PROG (no need to quote options
                        containing spaces)
    --PROG-options=OPTS give extra options to PROG

The flags --with-PROG and --PROG-option(s) can be used with the following programs:
  alex ar c2hs cpphs gcc ghc ghc-pkg ghcjs ghcjs-pkg greencard haddock happy
  haskell-suite haskell-suite-pkg hmake hpc hsc2hs hscolour jhc ld lhc lhc-pkg
  pkg-config strip tar uhc

[Haskell] add search directories option to ghci

Debug with this
$ ghci src/Test/ParseCircus.hs 

will lead to a problem such as
src/Test/ParseCircus.hs:14:8:
    Could not find module ‘Language.ISOZ.Parser.SynTransformerTwo’
    Use -v to see a list of the files searched for.
Locations searched:
  Language/ISOZ/Parser/SynTransformerTwo.hs
  Language/ISOZ/Parser/SynTransformerTwo.lhs
  Language/ISOZ/Parser/SynTransformerTwo.hsig
  Language/ISOZ/Parser/SynTransformerTwo.lhsig
 To fix it, add more folders to search directories by -i option

$ghci src/Test/ParseCircus.hs -isrc:dist/build
See reference