[Haskell-cafe] Best practice for embedding files in a GHC-compiled tool?

Dave Bayer bayer at cpw.math.columbia.edu
Thu Feb 7 07:53:15 EST 2008


On Feb 7, 2008, at 12:27 AM, gwern0 at gmail.com wrote:

> Are you assuming that the various users have GHC/Hugs installed? You  
> know about scripting through the 'runhaskell' binary, right?


I do, and I've used this. I don't want to do that here.

Let me say this again: I am making no assumptions whatsoever about  
various users, other than platform. Haskell is not a niche language,  
with the right compile options, it CAN be used in this way.

Here's the extreme case: When one is installing Mac OS X, one has  
access to a command line via a terminal application, but the operating  
system is otherwise very stripped down. Nevertheless, if one  
customizes an install DVD by adding a single command-line tool, one  
can execute that tool in this environment.

I'd rather use Haskell than C for such applications.

With C, we can introduce one file to an alien environment, and it will  
run. I've linked GHC Haskell programs that can be used in this way.  
Such programs can be used by anyone on a given platform. Assuming that  
GHC/Hugs is installed divides the potential audience by a large factor.

Under this extreme hypothesis, how do I embed a compressed tar file  
into a single file command line tool written in Haskell and compiled  
by GHC?

Thanks,
Dave


More information about the Haskell-Cafe mailing list