Skip to content

Avoid the indirection via .hs-incl files

Sylvain Henry requested to merge hsyl20/ghc:hsyl20/genprimop into master

Primops infos are generated by genprimopcode from primops.txt.pp. Before this patch, the build system was calling this program several times to generate each info into a separate .hs-incl file. This file was then included via CPP into a few .hs files in the compiler.

Failing to properly track these dependencies led to #17160 (closed).

With this patch, instead of generating those .hs-incl files, genprimopcode directly parses some Haskell files and replace placeholders of the form "%primop-something" with appropriate Haskell codes. It is designed to be similar to Alex/Happy. Haskell files with placeholders have a ".hs-prim" file extension.

Fix #17160 (closed)

Edited by Sylvain Henry

Merge request reports