[Haskell-cafe] The applicative instances for Either?

Roman Cheplyaka roma at ro-che.info
Sat Sep 17 10:52:30 CEST 2011


A natural reference would be the darcs repository

  http://darcs.haskell.org/packages/base/

or its git mirror

  http://darcs.haskell.org/packages/base.git

which I used because getting it is much faster.

Using 'git blame Control/Applicative.hs' I figured out that the instance
was added in this commit:

  commit 8abb469bd2210d78da74b334a0f4397be5ac37f6
  Author: Ross Paterson <ross at soi.city.ac.uk>
  Date:   Thu Jun 17 22:51:10 2010 +0000

      add Applicative instance for Either (proposal #4095)
      
      This is not the only possible instance for Either, but this one is
      compatible with the usual Monad instance.

Unfortunately, the git repository doesn't have proper tags that
correspond to the package version (if it did, we'd use 'git describe').

So, just go to the hackage page and check which release was the first
one after Jun 17 2010. It was 4.3.0.0, released on Nov 16 2010.

And so your dependency might look like "base >= 4.3".

OTOH, it would be very nice of library developers to have changelogs
and/or proper version tags in the VCS.

* Ketil Malde <ketil at malde.org> [2011-09-17 08:42:42+0200]
> 
> Hi,
> 
> I have a program that makes use of the applicative instance for Either
> String.  I used to define these instances locally, but at some point,
> they became part of Control.Applicative.  I have limited the
> dependencies to 'base >= 4', but apparently, some version 4s of base
> include this instance, some do not, and it causes problems for people
> trying to compile the program.
> 
> Is there any information, or otherwise accessible source specifying
> exactly when this was changed, so that I can have more precise
> dependencies?  And is there a simple way to handle this conditionally,
> either within cabal, or using CPP?

-- 
Roman I. Cheplyaka :: http://ro-che.info/



More information about the Haskell-Cafe mailing list