Where is `HsFFI.h` located?

I started using Haskell for about a month and is now doing C/C++ interop. This isn’t mentioned in the following page:

And the existing answer on the stackoverflow is outdated, pointing to /usr/local/lib/ghc-<version>/include/HsFFI.h.

Therefore I’m answering this for myself and in the future when someone new to Haskell encountered the same:

ghc-pkg field rts include-dirs --simple-output

This will output the directory where HsFFI.h is located.

It was mentioned on the Discourse but without the title “HsFFI.h”, so they are somewhat hard to find:

7 Likes