You could, but then you need overlapping instances to define the one in Control.Monad.Error.<div><div><br></div><div>-Edward Kmett<br><div><br><div class="gmail_quote">On Sat, Sep 12, 2009 at 4:26 PM, Henning Thielemann <span dir="ltr"><<a href="mailto:lemming@henning-thielemann.de">lemming@henning-thielemann.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Evan Laforge schrieb:<br>
<div class="im">> On Fri, Sep 11, 2009 at 6:10 AM, Edward Kmett <<a href="mailto:ekmett@gmail.com">ekmett@gmail.com</a>> wrote:<br>
>> Unfortunately, the instance of Monad for Either a is somewhat misguided in<br>
>> Haskell.<br>
>><br>
>> There is a spurious restraint that the Left value in your Either be a member<br>
>> of some Error class, which was brought about by the deletion of MonadZero<br>
>> from Haskell 98 (as part of the elimination of failure free patterns, and an<br>
>> attempted simplification of the language).<br>
><br>
> I just tried it, and my own instance for Monad (Either String) (all<br>
> I'm really interested in anyway) can coexist with the one for Error e<br>
> => Monad (Either e). But indeed, with the presence of fail, you can't<br>
> write the general Monad (Either e) which "should" work. And it does<br>
> require FlexibleInstances. I suppose as long as flexible instances<br>
> aren't standard then even the String instance can't go in the Prelude.<br>
<br>
</div>Are you sure, that the instance cannot be defined in Haskell 98 using a<br>
helper type class for the Char datatype?<br>
<a href="http://www.haskell.org/haskellwiki/List_instance" target="_blank">http://www.haskell.org/haskellwiki/List_instance</a><br>
<br>
</blockquote></div><br></div></div></div>