
I've been slowly making my way through Yet Another Haskell Tutorial. As a first introduction to the language it doesn't seem bad at all. However, I'm wondering about the proposed solution to exercise 9.2. The text itself suggests using "instance Monad (Either String) where", so I arrived at instance Monad (Either String) where return a = Right a fail a = Left a Right a >>= f = f a Left a >>= _ = Left a However, when loading it in ghci 6.6 I get the following error message: Illegal instance declaration for `Monad (Either String)' (The instance type must be of form (T a b c) where T is not a synonym, and a,b,c are distinct type variables) In the instance declaration for `Monad (Either String)' The solution, according to the author is instance Monad (Either String) where return x = Right x fail s = Left s Right x >>= f = f x Left s >>= _ = Left s Which results in exactly the same error message. I'm suspecting this is a result of my limited grasp of Haskell's syntax (an area where YAHT is sorely lacking). Any tips/pointers appreciated. /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus.therning@gmail.com http://therning.org/magnus Software is not manufactured, it is something you write and publish. Keep Europe free from software patents, we do not want censorship by patent law on written works. As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they do not refer to reality. -- Albert Einstein