2

Rather than invent my own, what are good makefile rules for typical Haskell tasks such as compiling, packaging, hlint, quickcheck, etc?

In a search I find things like like this example:

ghc -M *.hs
recursion.ninja
  • 5,377
  • 7
  • 46
  • 78
haroldcarr
  • 1,523
  • 15
  • 17

1 Answers1

9

Forget make; just use cabal-install.

Daniel Wagner
  • 145,880
  • 9
  • 220
  • 380
  • 2
    also see: [How to write a Haskell program](http://www.haskell.org/haskellwiki/How_to_write_a_Haskell_program) – ErikR Nov 04 '13 at 17:22
  • In the examples shown for both cabal-install and "how to..." `runhaskell Setup build` and `cabal haddock`. Does anyone use Make to orchestrate the use of cabal? – haroldcarr Nov 04 '13 at 19:20
  • @haroldcarr Just running `cabal install` will do both of those if you turn `documentation: True` in `~/.cabal/config`. – Daniel Wagner Nov 04 '13 at 19:29
  • Seems I should read the doc carefully. Will it do `hlint` too? – haroldcarr Nov 04 '13 at 19:41
  • @haroldcarr You can set up a test suite and run it with `cabal test`. – Daniel Wagner Nov 04 '13 at 19:53
  • Great. So now what would useful is to see some example cabal config files that are used in production code. Thanks, H – haroldcarr Nov 04 '13 at 19:58
  • @haroldcarr I tend to run hlint through a .ghci file, as described [here](http://neilmitchell.blogspot.co.uk/2010/01/using-ghci-files-to-run-projects.html). – Neil Mitchell Nov 04 '13 at 22:11
  • @haroldcarr Just take a look at the cabal files of the most depended on libraries (say _text_, _unordered-containers_, _snap_ etc). These are all used in production in various situations, should be representative. Especially for the test/benchmark bits of the cabal file. And yes, cabal is pretty much the basis for the tasks you mentionned in your question. – Alp Mestanogullari Nov 05 '13 at 07:50