[darcs-devel] darcs patch: Remove some use of GHC internals and fix... (and 11 more)

Ian Lynagh igloo at earth.li
Sun Apr 3 07:46:46 PDT 2005


On Sun, Apr 03, 2005 at 09:55:33AM -0400, David Roundy wrote:
> 
> The making FastPackedString portable patch scared me, so I didn't apply it
> either.  It had just enough #ifdefs in it that I couldn't see from looking
> at it exactly what was being done.  I'd prefer configure tests and
> Workaround.hs (if necesary) rather than #ifdefs, unless there's a good
> reason for the #ifdefs.

The problem is hugs doesn't have Foreign.Concurrent.newForeignPtr
and I couldn't see a sane way to do
    newForeignPtr p (do {c_munmap p l; return (); })
without it.

We could make a finaliser and use Foreign.ForeignPtr.newForeignPtr to do
the munmap, but then that finaliser would need to be freed after it had
been run.

So the ifdefs only try to do mmapping when __GLASGOW_HASKELL__ is
defined. I don't think this can be done more nicely, other than using a
HAS_MMAP symbol instead of __GLASGOW_HASKELL__. I guess you might prefer
a dummy Foreign.Concurrent.newForeignPtr that just returns an error
coupled with use_mmap to not try calling it.

> It definitely seems worthwhile to get configure tests written that will
> work with hugs.  Is anyone interested (from what you say about hoping
> someone else will volunteer for the autoconf magic, I'm guessing it's not
> you, Ian) in volunteering to maintain the darcs hugs port?

Once the autoconf stuff is done it shouldn't really need much
maintainence. Just have the darcs check script try to compile/load in
hugs and that will catch regressions. It should also be possible to run
the tests with the hugs darcs, but that would probably be too painful to
do by default.

> > [Avoid cpp \ line continuation
> > Ian Lynagh <igloo at earth.li>**20050402194918] {
> > hunk ./Record.lhs 289
> > - -get_date opts | Pipe `elem` opts = do cleanDate `liftM` \
> > - -                                      askUser "What is the date? "
> > +get_date opts
> > + | Pipe `elem` opts = do cleanDate `liftM` askUser "What is the date? "
> 
> I find it interesting that you didn't take this opportunity to eliminate
> the distastefully unnecesary "do"... :)

You got me  :-)
Too blinkered by the problem I was fixing to notice, I guess  :-)


Thanks
Ian





More information about the darcs-devel mailing list