I have defined types for the Peano numbers
class Plus (n :: T) (m :: T) (r :: T) | r n -> m
instance Plus 'Zero m m
instance Plus n m r => Plus ('Succ n) m ('Succ r)
Now I find myself having two constraints Plus a b c
and Plus c d e
.
How can I define an addition operation on my class such that the compiler is able to derive Plus a (b + d) e
?