[Haskell-cafe] How to escape from typecheck error: Duplicate instance declarations ?

s9gf4ult at gmail.com s9gf4ult at gmail.com
Fri Jan 25 21:39:40 CET 2013


> This has the code smell of trying to use typeclasses for OOP.  That won't 
work.  (Yes, really.)

I am not trying to use OOP, I am just writing some typecasting at all. 

> This would be correct.  Constraints on an instance are applied *after* the 
instance is selected, so when Haskell is looking for an instance, these two 
are identical.

I didn't understand why these two instances are identical ? The constraints 
are different and OverlappingInstances should permit overlapping typeclasses 
in constraints and select more specific instance clause.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130126/efa5a626/attachment.htm>


More information about the Haskell-Cafe mailing list