Monad class contains declaration<br><br clear="all"><b>fail</b> :: String -> m a<br><br>and provides default implementation for 'fail' 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 -> a <br><br>which stops execution and displays an error message.<br><br>Questions:<br>1) What value and type 'error' actually returns in:<br>error "some message" ?
<br><br>2) How declaration <br>String -> m a<br>matches with<br>String -> a ?<br><br>3) In Maybe monad:<br>fail = Nothing<br><br>When and how 'fail' 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>