[Haskell-cafe] Problem on overlapping instances
magicloud.magiclouds at gmail.com
Wed Jan 5 13:25:21 CET 2011
Sure. GHC would prompt that.
Jasper Van der Jeugt:
Not working with ghc7. But there sure are some threads about this
kind of things. I do not know if this is a bug of 6.* or 7, either.
Sorry, by special, I meant, for example, ["a", "b"] will be "ab" by
default, but I want it to be "a,b". So I'd like to overload for
I think that are the only choices. The first is simple, but the
second saves some code writing.
After all, thanks.
On Wed, Jan 5, 2011 at 4:41 PM, Stephen Tetley <stephen.tetley at gmail.com> wrote:
> You have two choices (other people have enumerated the first while I
> was typing):
> First choice:
> Wrap your Stringlist with a newtype:
> newtype StringList = StringList [String]
> The downside of this your code gets "polluted" with the newtype.
> Second choice:
> Write special putStringList and getStringList functions. Hand-code the
> binary instances where you are wanting [String] to be special and call
> putStringList and getStringList rather than put and get.
> Downside - cannot automatically derive Binary. That's if Binary can be
> automatically derived anyway?, the times when I need Binary I write
> the instances myself anyway.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe