
17 Jul
2009
17 Jul
'09
10:19 a.m.
On Tue, Jul 14, 2009 at 10:05:03AM -0400, MH wrote:
Could you please elaborate on how does the constraint (ListConcat xs ys zs) makes the instance ListConcat (x ::: xs) ys (x ::: zs) recursive.
instance (ListConcat xs ys zs) => ListConcat (x ::: xs) ys (x ::: zs) where listConcat = _|_
This says that '(x ::: xs) ys (x ::: zs)' is an instance of ListConcat *if* 'xs ys zs' is. So you can think of the 'ListConcat xs ys zs' constraint as a recursive call made by 'ListConcat (x ::: xs) ys (x ::: zs)'. As a Haskell function we might write it something like this: isListConcatInstance (x ::: xs) ys (z ::: zs) = x == z && isListConcatInstance xs ys zs Does that help? -Brent