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

On Feb 7, 2008, at 12:27 AM, gwern0@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

Op 7-feb-2008, om 13:53 heeft Dave Bayer het volgende geschreven:
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?
Hack up a shell script or a small Haskell program to automatically generate a Haskell file of the form:
module TarFile where
import Data.ByteString as B
myTarFile = B.pack [<tar file as list of Word8s here>]
You could also do that using Template Haskell, as you already hinted, but this sounds less like rocket science :-) Reinier
participants (2)
-
Dave Bayer
-
Reinier Lamers