Monad class contains declaration<br><br clear="all"><b>fail</b> :: String -&gt; m a<br><br>and provides default implementation for &#39;fail&#39; as:<br><br>fail s = error s<br><br>On the other hand Prelude defines:<br><b>
<span style="font-weight: bold;"><br></span>error</b> :: String -&gt; a <br><br>which stops execution and displays an error message.<br><br>Questions:<br>1) What value and type &#39;error&#39; actually returns in:<br>error &quot;some message&quot; ?
<br><br>2) How declaration <br>String -&gt; m a<br>matches with<br>String -&gt; a ?<br><br>3) In Maybe monad:<br>fail = Nothing<br><br>When and how &#39;fail&#39; is used in Maybe monad?<br><br>Thanks!<br><br>-- <br>Dmitri O. Kondratiev
<br><a href="mailto:dokondr@gmail.com">dokondr@gmail.com</a><br><a href="http://www.geocities.com/dkondr">http://www.geocities.com/dkondr</a>