On 4 August 2010 07:42, Joachim Breitner <m...@joachim-breitner.de> wrote: > out of a discussion in haskell-devscripts, John MacFarlane wrote a very > nice tool, called hsb2hs, that allows you to include any binary (or > text) file as a constant in your program.
When I've needed to do this in the past, I've used a simple bit of Template Haskell: """ module Embed where import Language.Haskell.TH embedFile :: String -> ExpQ embedFile fp = runIO (readFile fp) >>= stringE """ Here is how you use it to implement a (cheaty sort of) quine: """ {-# LANGUAGE TemplateHaskell #-} import Embed foo = $(embedFile "UseEmbed.hs") main = putStrLn foo """ Cheers, Max _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe