[Haskell-cafe] Re: systemtimmetypeable: Workaround for lack of deriveable data instance in either System.Time or Data.Time.

Thomas Hartman tphyahoo at gmail.com
Wed Oct 21 12:15:52 EDT 2009


update:

on haskell reddit, dons suggested simply patching time. reasonable
enough, but I hit a glitch where the Data.Fixed (in base lib) was
missing a Data instance, and gave up when I couldn't find the source
repo for base. Is this simply part of ghc?

Anyways, that instance seems to be added in ghc 6.12 so probably a non
issue now or closer to it.

http://www.haskell.org/ghc/dist/current/docs/html/libraries/base/Data-Fixed.html

also, aavogton #haskell suggested

http://hpaste.org/fastcgi/hpaste.fcgi/view?id=11009#a11009

as a workaround for people using time on happstack earlier than 6.12,
probably nicer than the MyTime hack I created though it comes with a
bit more baggage.

I haven't upgraded to 6.12 but I would suggest that time now be made
Data Generics friendly if it hasn't already, since this is probably a
very simple change and would be helpful to happstack. If no one has
time to do this I'll try to get around to it when I upgrade to 6.12.

Also wouter swierstra suggested that standalone deriving (
http://www.haskell.org/ghc/docs/latest/html/users_guide/deriving.html#stand-alone-deriving
) could be helpful in this case but I'm not sure why, or even whether
this was for data-izing data.time or system.time or both.

Given all this I won't be uploading anything to hackage, and hopefully
the base libs + time will be data friendly soon enough.

thomas.

2009/10/19 Thomas Hartman <tphyahoo at gmail.com>:
> At
>
> http://osdir.com/ml/haskell-cafe@haskell.org/2009-10/msg00197.html
>
> I griped that the lack of Data-Derivable time values was causing me
> headache in happstack.
>
> In the proposed cabal package
>
> http://patch-tag.com/r/tphyahoo/systemtimetypeable/snapshot/current/content/pretty/systemtimetypeable.cabal
>
> I submit a workaround that, while probably not the ideal thing, has
> proved helpful to me.
>
> Basically, I use the type MyTime, which is data-deriveable, when
> working with Macid in happstack; and convert from System.Time and/or
> Data.Time with the accompanying utility functions when necessary.
> Perhaps the utility functions are useful on their own as well. I found
> it surprisingly hard to get from Data.Time values to System.Time
> values.
>
> Anyways, I am interested in what others think and, of course, patches
> and suggestions welcome.
>
> thomas.
>


More information about the Haskell-Cafe mailing list