[Haskell-cafe] Re: Trying to avoid duplicate instances

Eric Stansifer stansife at caltech.edu
Wed May 14 07:51:34 EDT 2008


Thanks for your detailed input -- I appreciate seeing these rather
abstract techniques being applied to specific problems.

Tom Nielsen pointed me in the direction of the solution you've
supplied, so I should have replied to the list that my question had
been addressed.  Anyhow, I now have code that looks a little like:

> class DummySolidObject flag o
> class SolidObject o
>
> instance FiniteSolidObject o => DummySolidObject Dummy1 o
> instance InfiniteSolidObject o => DummySolidObject Dummy2 o
> instance DummySolidObject d o => SolidObject o
>
> data Dummy1
> data Dummy2

Thanks,
Eric


More information about the Haskell-Cafe mailing list