Generic Instance #53

Open
2piix opened this Issue Dec 18, 2012 · 4 comments

Projects

None yet

4 participants

@2piix
2piix commented Dec 18, 2012

Howdy,

Can we have Generic instances for HashMaps and HashSets? I wrote a patch, if you are interested.

-Alex

@tibbe
Owner
tibbe commented Dec 18, 2012

I don't see why not. I guess the instances looks similar to the ones in the containers package?

@2piix
2piix commented Dec 18, 2012

I haven't looked at the 'containers' instances -- I just used:

{-# OPTIONS_GHC -XDeriveGenerics #-}
import GHC.Generics
deriving (Generic, Typeable)

in the appropriate places. I'll push it shortly.

On Mon, Dec 17, 2012 at 7:11 PM, Johan Tibell notifications@github.comwrote:

I don't see why not. I guess the instances looks similar to the ones in
the containers package?


Reply to this email directly or view it on GitHubhttps://github.com/tibbe/unordered-containers/issues/53#issuecomment-11472301.

@jaspervdj

To come back on this, I don't think this and #54 are super useful for now.

Most practical applications of Generic require that the whole datatype tree, i.e., including the datatypes underneath, derive Generic. Since we can't have this for unlifted types (Array#), this doesn't really work well. I the rare cases where we do need the instance, using StandaloneDeriving as I demonstrated in #25 should do the trick.

@treeowl
treeowl commented Aug 6, 2015

This is becoming a problem for me personally. How hard would it be to make a bogus instance like the ones in containers while waiting for a better answer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment