Data instance for Data.Version

Edward Kmett ekmett at gmail.com
Fri Sep 13 09:24:48 CEST 2013


If the instances are hand-rolled in base, you'll need:

instance Data Version where
  gfoldl k z (Version bs ts) = z Version `k` bs `k` ts
  gunfold k z c = case constrIndex c of
    1 -> k (k (z Version))
    _ -> error "Data.Data.gunfold(Version)"
  toConstr (Version _ _) = versionConstr
  dataTypeOf _ = versionType
versionConstr :: ConstrversionConstr = mkConstr versionType "Version"
["versionBranch","versionTags"] Prefix
versionType :: DataTypeversionType = mkDataType "Data.Version.Version"
[versionConstr]



On Thu, Sep 12, 2013 at 7:24 AM, Herbert Valerio Riedel <hvr at gnu.org> wrote:

> Hello *,
>
> As we're still in time to get this in before the GHC 7.8 freeze and this
> seems to be "the right thing" to do, are there any objections to
> implement this (specifically, adding a `deriving Data` to `base`s
> Data.Version for GHC 7.8.1)?
>
> Cheers,
>   hvr
>
> On 2013-03-15 at 23:29:21 +0100, Edward A Kmett wrote:
> > +1 from me. I've had to use an orphan
> >
> > Sent from my iPhone
> >
> > On Mar 15, 2013, at 5:56 PM, David Lazar <lazar6 at illinois.edu> wrote:
> >
> >> Hi,
> >>
> >> Can we derive Data for Data.Version.Version? It would benefit Cabal.
> >>
> >> Thanks,
> >> David
> >>
> >> _______________________________________________
> >> Libraries mailing list
> >> Libraries at haskell.org
> >> http://www.haskell.org/mailman/listinfo/libraries
>
> --
> "Elegance is not optional" -- Richard O'Keefe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130913/c1ff8b0c/attachment.htm>


More information about the Libraries mailing list