
Hi, I saw that it's possible to peal off kinds from the right-hand side when instantiating classes. Is it possible to peel them off from the left-hand side? Or in any order? I have been told in #haskell by people who seems to know that Very Bad Things happen if you do this without also making the kind system more clever. Is there a quick fix that will give me the same effect, without introducing a newtype or re-writing the original type declaration to introduce the extra types in a different order? Illustrative code below. Matthew data MyType e = Singleton e data MyOtherType k v = Empty | Node k v data YetAnotherType k v = OtherEmpty | OtherNode k v type RevYAT v k = YetAnotherType k v class Iterable ite where iterate :: ite e -> [e] instance Iterable MyType where iterate (Singleton e) = [e] instance Iterable (MyOtherType k) where iterate ite = [] --broken but illustrative instance Iterable (RevYAT v) where iterate it = [] --broken again Type synonym `RevMOM' should have 2 arguments, but has been given 1 In the instance declaration for `Iterable (RevYAT v)'
participants (1)
-
Matthew Pocock