Relaxin the PVP with regards to adding instances
Michael Sloan
mgsloan at gmail.com
Thu Sep 6 11:58:05 CEST 2012
Interesting ideas!
One way to make explicit re-export pragmas less necessary would be to
ignore package-local re-exports. This might seem funky initially,
there's precedent for involving packages with import semantics
(package-qualified imports), and this is a sensible granularity for
such judgments because it's reasonable to assume "global" knowledge of
instances inside a package.
To minimize need for explicit pragmas, we could have another variety
of module export that specifies which imports provide instances that
should be explicitly re-exported. While the explicit pragma might
still be desirable (seems fiddly, though..), I think that this would
cover a great deal of the problems. The syntax might look like:
module Foo(..., module instances Bar) where
import Bar
Could also think about "filtering" based on partial specifications -
"Only re-export Monad instances", "Only re-export things involving
Maybe", "Hide everything involving Maybe", etc etc. This gets a bit
more complicated:
module Foo(..., module instances Bar(Monad, Maybe)) where
import Foo
I'm not at all sold on this more complicated one, but something along
this line might be good.
-mgsloan
On Thu, Sep 6, 2012 at 2:10 AM, Henning Thielemann
<schlepptop at henning-thielemann.de> wrote:
> Am 06.09.2012 02:43, schrieb Michael Sloan:
>
>> I agree that it's quite unfortunate that adding instances causes a
>> major bump. I think that instead it would make sense to only bump
>> your major version whenever you add *orphan* instances. This is
>> because it is known to be dangerous to create orphan instances, and
>> the errors are relatively transparent. While I suppose it could break
>> proper dependency resolution, a big reason for upper bounds is
>> preventing a cascade of confusing errors. With orphan instances the
>> errors are very finite.
>>
>> In general here are a few different things that would help with the
>> orphans problem:
>
>
> There have been some ideas about explicit import of instances.
>
> I also had some thoughts about how GHC can help managing orphan instances
> when they are necessary:
> http://www.haskell.org/pipermail/haskell-cafe/2011-July/094014.html
>
More information about the Libraries
mailing list