Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make Stack call Happy, Alex and other build tools?

As part of my compiler, I need alex and happy to run as part of my build process. How does Stack support this scenario?

Bonus: how can I register alex and happy as compile-time dependencies?

like image 261
Carl Patenaude Poulin Avatar asked Oct 02 '15 00:10

Carl Patenaude Poulin


1 Answers

cabal understand the suffixes .x for alex files and .y for happy files and will automatically use alex and happy to build the corresponding .hs files.

Steps to undertake:

  1. Add the .x and .y files to your extra-source-files: section
  2. Add alex and happy to your build-tools: section
  3. If your source file is Foo.Bar.x, make sure that Foo.Bar is listed in exposed-module: or in other-modules:

A good example of a package using alex and happy is the language-python package:

https://github.com/bjpop/language-python/blob/master/language-python.cabal

Update: This is relevant to stack as well. In fact, stack will also build alex and happy for you.

like image 138
ErikR Avatar answered Oct 28 '22 09:10

ErikR