Re: [Haskell-cafe] Time Typeable Instances

2009-10-23 Thread Duncan Coutts
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

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Time Typeable Instances

2009-10-22 Thread Warren Harris

Hi John,

I just stumbled on this issue while trying to compile turbinado with  
the haskell platform / ghc 6.10.4. I got past it by manually editing  
back in the time definitions, but just wondering if there was an  
official resolution. Thanks,


Warren


On Oct 13, 2009, at 6:48 AM, John Goerzen wrote:


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 jgoer...@complete.org
mailto:jgoer...@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




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Time Typeable Instances

2009-10-13 Thread John Goerzen
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 jgoer...@complete.org
 mailto:jgoer...@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
 
 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe