Proposal: Add the unordered-containers package and the hashable package to the Haskell Platform

Herbert Valerio Riedel hvr at
Wed Mar 20 13:25:30 CET 2013

Gábor Lehel <illissius-Re5JQEeQqe8AvxtiuMwx3w at> writes:

> Compatibility issues aside, is there any reason newtypes aren't a good
> solution here? You could get away with just one:

this may be a bit off-topic, but I've been wondering for some time now,
how to compose newtype-based typeclass instances?

for instance, now we have a special newtype for 'Int's,

> instance Hashable (FasterInsecureHashing Int) where
>     hash = unFIH

then for some reson we have a another package, which uses newtypes to
provide alternative instances for newtypes, let's say the binary package
starts defining a 'Binary' newtype-wrapped instance for serializing to
PDP-byteordering, .i.e.

instance Binary (PdpSerialization Int) where
    put i = ...
    get = ...

How do would I combine those two newtypes, if I wanted to have a nested
data-structure such as

  IntMap Int (Int,[(Int,Int)])

hashed with the FasterInsecureHashing variant, as well as serialized
with the PdpSerialization instances?


More information about the Libraries mailing list