[darcs-users] darcs patch: add conditional compilation to support m... (and 1 more)

Jason Dagit dagit at codersbase.com
Sun Nov 28 23:04:21 UTC 2010


Hello,

I was trying to get darcs 2.5 to compile under ghc7.  Along the way I
learned a few things:

  1. ghc 7.0.1 (the current stable release), has this bug when
  compiling the darcs source (fixed and should appear in next ghc
  release): http://hackage.haskell.org/trac/ghc/ticket/4524

  2. versions of ghc older than 7 cannot change LANGUAGE options per
  file inside of #ifdefs. (I don't have a link to a refrence, but my
  experience shows this to be true and others in #haskell have
  confirmed my experience.)

  3. http://hackage.haskell.org/trac/ghc/blog/LetGeneralisationInGhc7
  says, "The -XGADTs or -XTypeFamilies pragmas switch on
  MonoLocalBinds but, if you want, you can override it with
  -XNoMonoLocalBinds (or the equivalent LANGUAGE pragma). The type
  checker will then do its best to generalise local bindings, and your
  program will almost certainly work. However, I don't know how to
  guarantee any good properties of the type inference algorithm. So I
  think this is ok as as short term fix, but I'd like to encourage you
  to add that handful of type signatures instead."

The gist of #1 is that ghc 7.0.1 panics when compiling 1 module of
darcs when we are passing NoMonoLocaBinds.  Point #2 means we can't
simply use #ifdef to disable NoMonoLocalBinds in that file.  I didn't
check if ghc 6.12 or 6.10 barfs when passed -XNoMonoLocalBinds (an
option neither of them should understand).

Due to point #3, I think the correct way forward is to provide the
extra type signatures and NOT use NoMonoLocalBinds.  Plus, #1 and #2
work together to actually make it MORE difficult to get things working
without the extra type signatures.  Thus, I have based my work off of
Ganesh's 2.5 branch where he added in the type signatures.

I also made things work with mtl 1 or mtl 2.

When this patch bundle is applied to Ganesh's branch, it makes sure
that darcs compiles cleanly under ghc7.0.1 and ghc6.12.3 on OSX 10.5
with either mtl1 or mtl2.  Our standard build screening would be wise
though.

I have not checked if this work applied cleanly to the repo at
http://darcs.net, but the changes are small and I would hope it
applies.

Thanks,
Jason

2 patches for repository http://darcs.vm.spiny.org.uk/~ganesh/darcs-2.5-ghc7-2:

Sun Nov 28 14:44:54 PST 2010  Jason Dagit <dagit at codersbase.com>
  * add conditional compilation to support mtl 1 and mtl 2.

Sun Nov 28 14:46:40 PST 2010  Jason Dagit <dagit at codersbase.com>
  * loosen constraint on containers package

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-darcs-patch
Size: 7410 bytes
Desc: A darcs patch for your repository!
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20101128/eff179d8/attachment.bin>


More information about the darcs-users mailing list