[Haskell-cafe] Time Typeable Instances

John Goerzen jgoerzen at complete.org
Tue Oct 13 09:48:20 EDT 2009


Hugo Gomes wrote:
> The Glorious Glasgow Haskell Compilation System, version 6.10.4
> with old-time-1.0.0.2 and time-1.1.2.4
> 
> This is a standard haskell platform on a windows xp. Cabal install
> didn't work complaining about missing instances of typeable for posix
> time and other datatypes, yet, after removing the macros (thus, adding
> those instances), hdbc and convertible compiled and installed fine. 
> 
> Removing the macros might be a bit overkill, probably finetuning them so
> that they add only the necessary instances for typeable in ghc > 610
> might be a better solution.

I'm going to CC haskell-cafe on this because I am confused.

Hugo, can you confirm what version of convertible you have?

Back on May 21, I started a thread [1] on haskell-cafe complaining that
GHC 6.10.3 included a newer time that included instances of Typeable for
NominalDiffTime and UTCTime.  This broke my code, which had manually
defined instances for these types, as they were needed.  Things got
complicated, as only time's minor version number got incremented
(x.x.x.Y) [2].  Cabal can't test against that version number.

I wanted my code to work with old and new versions of GHC.  Since
testing against the version of time was impossible, I did the next best
thing: tested against the version of GHC.

#if __GLASGOW_HASKELL__ >= 610
-- instances added in GHC 6.10.3
#else
instance Typeable NominalDiffTime where
    typeOf _ = mkTypeName "NominalDiffTime"

instance Typeable UTCTime where
    typeOf _ = mkTypeName "UTCTime"
#endif

Also, in the .cabal, there is a build-depends on time>=1.1.2.4.

Now, that would break for GHC 6.10.1 and 6.10.2 users, but will work for
6.10.3 and above, or 6.8 and below.  Or so I thought.

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.

1) Did the Typeable instances get dropped again from time?
2) What exactly should I do so this library compiles on GHC 6.8 and 6.10.x?

I'm looking at the darcs repo for time and don't see the instances ever
getting dropped.

[1] http://osdir.com/ml/haskell-cafe@haskell.org/2009-05/msg00982.html
[2] http://osdir.com/ml/haskell-cafe@haskell.org/2009-05/msg00985.html


.... later addendum ....

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.

Does this sound right?

> 
> 
> On Tue, Oct 13, 2009 at 2:51 AM, John Goerzen <jgoerzen at complete.org
> <mailto:jgoerzen at complete.org>> wrote:
> 
>     Hugo Gomes wrote:
>     > Hi,
>     >
>     > convertible and hdbc packages fail to compile in my standard
>     instalation
>     > of the haskell platform. I think this has to do with those "if ghc >=
>     > 610" macros on the typeable instances for some datatypes. I
>     removed them
>     > and now they work fine...
>     >
>     >
>     >
> 
> 
>     What version of GHC and time do you have?
> 
>     -- John
> 
> 



More information about the Haskell-Cafe mailing list