MonoLocalBinds and darcs

Simon Peyton-Jones simonpj at microsoft.com
Wed Nov 3 06:10:53 EDT 2010


|  > Make sure you are using RC2 of the compiler, from what I remember RC1
|  > required signatures it shouldn't have, or enabled MonoLocalBinds more
|  > than it should - RC2 required less signatures. However, your code
|  > could well just be heavily using the relevant features.
|  
|  I was using RC2. But darcs uses GADTs globally so MonoLocalBinds is always
|  on.
|  
|  I've now retested with NoMonoLocalBinds properly enabled and I just needed
|  one extra signature. 

OK that's better!  I was surprised when you said it didn't work.  If you had type signatures to make GADTs work, you may be able to remove some of them, in which case you'd be in profit :-)

| That's quite compelling, but I'm aware it's not
|  considered a "reliable" feature so I'm not quite sure which way to go.

Well, I'm aware that it's a compromise.  I don't know how to do a bang-up principled job of typechecking local polymorphism, so GHC does a best-effort job.  In fact best effort is pretty good, and it's not hard to implement, so
	a) I don't expect to remove NoLocalMonoBinds
	b) I expect it will work fine 99% of the time
My suggestion would be to keep it as a {-# LANGUAGE NoLocalMonoBinds #-} in each module that needs it for now.  You can remove it gradually.

Concrete examples of where the absence of local polymorphism is painful would also be a good thing; you could attach a comment to my blog post.  Maybe there are useful special cases or something.  

Simon


More information about the Glasgow-haskell-users mailing list