[Haskell-cafe] Are conditional changes in library interfaces problematic?
Adam Bergmark
adam at bergmark.nl
Fri Feb 6 12:36:49 UTC 2015
transformers 0.4 deprecated ErrorT in favor of ExceptT. I've noticed that
several packages use CPP to conditionally add ExceptT instances, like this:
```
#if MIN_VERSION_transformers(0,4,0)
instance C m => C (ExceptT e m) where
#endif
```
The problem I've found with this is that I will get a different interface
depending on which transformers version is picked.
There is a transformers-compat[1] library that provides ExceptT when using
older versions of transformers, when combining these I end up with a
compilation failure since the ExceptT instances are no longer included due
to CPP.
The alternatives I see are:
1. Use transformers-compat (and as of today mtl-compat[2])
2. Drop support of older versions of dependencies
3. Advise against compat packages
The first alternative seems preferable from a user's standpoint. For
transformers and mtl I argue it's the most pragmatic option. I think the
compat packages are a good thing, especially for core packages, since they
let us maintain backwards compatibility.
Do you agree with this line of thought? I started working on pull requests
to "fix" this but I'd appreciate feedback on the issue first.
Along these lines, does conditionally altering the interface of a package
like this violate the PVP?
Cheers,
Adam
[1] http://hackage.haskell.org/package/transformers-compat
[2] http://hackage.haskell.org/package/mtl-compat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20150206/ef729d58/attachment.html>
More information about the Haskell-Cafe
mailing list