[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Small package or big dependencies?



+++ Joachim Breitner [Aug 02 10 21:45 ]:
> Hi,
> 
> Am Montag, den 02.08.2010, 12:38 -0700 schrieb John MacFarlane:
> > > Did you consider a third variant: Actually linking the hook into your
> > > code, as a (Byte)String constant, and writing it out to disk when
> > > creating a gitit-enabled repository? Then there is no such problem at
> > > all, and the hook is always tied directly to the code. (Probably does
> > > not work as you’d need to update the hook when you upgrade the code,
> > > right?)
> > 
> > In the case of filestore, I could do that. I used to do something like that
> > for pandoc, but switched for various reasons to using data files. As you
> > note, it's a maintenance hassle if the bytestring is just a literal in the
> > code. I could avoid this by using template haskell, but that introduces its
> > own headaches (recall the difficulties TH caused on some architectures with
> > earlier versions of pandoc). I could also avoid it without template Haskell,
> > possibly, with a custom Setup.hs that reads the data file and writes out a
> > Haskell file. But now we're getting farther and farther from the nice, clean
> > mechanism for data files that Cabal provides.
> 
> slightly diverging from the original question: Couldn’t Cabal directly
> provides support for this? It automatically detects files like ".y". It
> could convert a file ending in ".blob" to a haskell file containing the
> data as a raw bytestring, or even convert it directly to a .o file with
> a corresponding FFI wrapper that can be linked into the libraries.
> 
> I’m sure there are a few use cases. E.g. icons for executables on
> windows, or binaries which contain the manpage as the documentation
> source.

I think that's an excellent idea, and, though I can't change Cabal,
I've whipped up a little program that can be integrated with Cabal
using the preprocessor hook.

http://github.com/jgm/hsb2hs

You can look at an example of its use in the sample directory.
If this seems a good idea, I may revise filestore to use this
technique.

John


Reply to: