[Haskell-cafe] How to escape from typecheck error: Duplicate instance declarations ?
Brandon Allbery
allbery.b at gmail.com
Fri Jan 25 21:24:20 CET 2013
On Fri, Jan 25, 2013 at 3:18 PM, <s9gf4ult at gmail.com> wrote:
> Duplicate instance declarations:
>
> instance [incoherent] (Num a, Ord a, Rangable range a,
>
> Packable range a) =>
>
> SubtypeOf range a
>
> -- Defined at ...:22:10
>
> instance [incoherent] (Integral a, Packable range a,
>
> MultipleTo range a) =>
>
> SubtypeOf range a
>
> -- Defined at ...:29:10
>
>
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.
This has the code smell of trying to use typeclasses for OOP. That won't
work. (Yes, really.)
--
brandon s allbery kf8nh sine nomine associates
allbery.b at gmail.com ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130125/6532b4b4/attachment.htm>
More information about the Haskell-Cafe
mailing list