[Haskell-cafe] Time Typeable Instances

Duncan Coutts duncan.coutts at googlemail.com
Fri Oct 23 09:00:55 EDT 2009


On Tue, 2009-10-13 at 08:48 -0500, John Goerzen wrote:

> Now I'm getting complaints from people using 6.10.4 saying that there
> are now missing instances of Typeable with time 1.1.2.4.

Right, because 1.1.2.4 is an earlier version than 1.1.3 which is the
random intermediate snapshot version included in the ghc-6.10.3
extralibs collection and the version where the Typable instances were
added.

So the problem you're noticing is that some people are using 1.1.2.4 and
others are using 1.1.3 or 1.1.4 and these are not related to the version
of ghc that they are using, so using the ghc version as a proxy fails.

> 1) Did the Typeable instances get dropped again from time?

No.

> 2) What exactly should I do so this library compiles on GHC 6.8 and 6.10.x?

Depend on the time library and use one of the following techniques:

If you're prepared to depend on Cabal-1.6 then you can use the cpp
macros that let you do conditional compilation on the version of a
package you depend on. You mention that the time only incremented the
4th digit when it added the instances but I don't think that's right. My
time-1.1.2.4 has no Typeable instances but 1.1.4 does (and I believe
1.1.3 did too). So you should be able to use this mechanism.

Alternatively you can use the "flag hack" in the .cabal file:

flag annoying-time-instances

library
  ...
  if flag(annoying-time-instances)
    build-depends: time >= 1.1.3
  else
    build-depends: time < 1.1.3
    cpp-options: -DUSE_OWN_TIME_TYPABLE_INSTANCES

> so it appears that what's happening here is that GHC 6.10.3 extralibs
> included time 1.1.3, but then haskell-platform standardized on 1.1.2.4.
>  This is pretty annoying -- that haskell-platform would standardize on a
> version older than what shipped with a GHC release -- but I guess I can
> work around it by restricting my build-dep to be time < 1.1.3 and
> re-adding the instances.

No, it's the haskell-platform that was and is doing the right thing and
it is ghc that subsequently accidentally shipped a random development
snapshot.

The platform has a commitment to provide API compatible versions of
packages within a major series. The first release of the platform used
time-1.1.2.4 (along with ghc-6.10.2) and thus it could not include the
time-1.1.3 that the subsequent release of ghc-6.10.3 accidentally
included.

Duncan



More information about the Haskell-Cafe mailing list