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

1

16

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?

Islek answered 2/10, 2015 at 0:58 Comment(0)
S
15

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 (permalink)

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

Splinter answered 2/10, 2015 at 1:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.