Suppose one is using the stack
build tool to make a Haskell library (importing packages from Hackage, and so forth) to be used with a C/C++ project in which main
is located in C/C++.
Supposing your project is named Lib.hs
(which uses external libraries from hackage), is there a way to use stack to export your Lib.o
, Lib.hi
, and Lib_stub.h
to be consumed by a C/C++ compiler like gcc
or g++
?
EDIT: A related question might be: "how can one use Stack as a build tool to be used with a Haskell & C/C++ project in which main
is located in C/C++?
EDIT2: Upon reflection, one way to solve this problem would be to use Stack as usual, but migrate your C/C++ main function to Haskell. Is this the best way to do it? Are there huge performance costs to this or anything I should be aware of?