Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting to the System GHC

Tags:

haskell

ghc

I know that the GHC API grants me the use as a library, access to the compiler features such as analyzing, running, and transforming Haskell codes. A Haskell program that imports the GHC as a package will, when compiled, include its own (partial) copy of the GHC, thus being executable even on systems without the GHC installed.

But what if I don't want to include the GHC in the program and, instead, use the one that is installed on the system?

So that, when the program is given a Haskell code, it will use the system's GHC to understand it and, when necessary, import all the packages and libraries (ones that are available on the GHCi) as well.

  1. Does the GHC (installed on different systems) provide such an API?
  2. If so, does the system documentation resources provide something similar too? (With which I can pick a function from a Haskell code and then look up to see the type signature, usage information and so on.)
like image 234
Minoru Avatar asked Feb 17 '13 06:02

Minoru


1 Answers

You can require the end-user install either BuildWrapper or scion and then interact with those programmatically. If you don't want to force that users install them, you can bundle their code with your executable, and have the executable call the system GHC to build them yourself.

like image 72
sclv Avatar answered Oct 07 '22 21:10

sclv