[Haskell-cafe] Restrictions on associated types for classes

Conor McBride conor at strictlypositive.org
Thu Dec 17 12:22:03 EST 2009


On 17 Dec 2009, at 15:31, Simon Peyton-Jones wrote:

> Hmm.  If you have
>   class (Diff (D f)) => Diff f where
>
> then if I have
> 	f :: Diff f => ...
> 	f = e
> then the constraints available for discharging constraints arising  
> from e are
> 	Diff f
> 	Diff (D f)
> 	Diff (D (D f))
> 	Diff (D (D (D f)))
> 	...
>
> That's a lot of constraints.

But isn't it a bit like having an instance

   Diff f => Diff (D f)

?

Conor


More information about the Haskell-Cafe mailing list