[Haskell-cafe] Embedding compiled Haskell Platform in custom application

Henk-Jan van Tuyl hjgtuyl at chello.nl
Mon Sep 23 15:23:45 CEST 2013

On Mon, 23 Sep 2013 14:03:00 +0200, blackbox.dev.ml  
<blackbox.dev.ml at gmail.com> wrote:

> Hi!
> I'm writing a tool that generates haskell code, build it with cabal and
> launch it. I want to deliver that tool to clients, but I don't want to
> force them, to install system wide any specific ghc or cabal version. How
> can I embed compiled ghc, cabal and selected libraries (for specific
> platform) in installer of my application?

In most cases, it is sufficient to copy the generated executable; when  
dynamic libraries are used by the executable (like e.g. wxHaskell does),  
they must be copied as well, preferably to the same directory as the  
executable. Note that the dynamic libraries, when created from Haskell  
source, must be compiled with the same version of GHC as the executable.

When e.g. data files are needed and the application uses the function  
getDataDir from Cabal, an environment variable must be set to indicate  
where the data files are located. For instance, to install wxAsteroids on  
an other system, the environment variable wxAsteroids_datadir must be set;  
see the file wxAsteroids\dist\build\autogen\Paths_wxAsteroids.hs (this  
file is generated while building the package). An online example is  

Henk-Jan van Tuyl

Folding at home
What if you could share your unused computer power to help find a cure? In  
just 5 minutes you can join the world's biggest networked computer and get  
us closer sooner. Watch the video.

Haskell programming

More information about the Haskell-Cafe mailing list