<div dir="ltr"><br><br><div class="gmail_quote">On Mon, Oct 26, 2009 at 6:19 PM, Darrin Thompson <span dir="ltr">&lt;<a href="mailto:darrinth@gmail.com">darrinth@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Sun, Oct 25, 2009 at 4:51 PM, Michael Snoyman &lt;<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>&gt; wrote:<br>
&gt; Comments are most welcome. I would like this to be a suitable replacement<br>
&gt; for the ubiquitous Maybe, (Either String) and ad-hoc Result data types so<br>
&gt; often used to report a failure. I&#39;d be very happy to improve the package for<br>
&gt; the general community.<br>
&gt;<br>
<br>
</div>I haven&#39;t actually tried writing code with this, just read the api<br>
docs. The api makes a lot of sense to me.<br>
<br>
I&#39;m a Python/Ruby guy. I see Haskell as short like Python, almost fast<br>
like C. Your attempt monad thing _makes_ _sense_ to me.<br>
<br>
One little nit I guess. Python had &quot;string as exception&quot; for awhile,<br>
now they discourage that. There seems to be a historical pattern where<br>
the right way to throw exceptions changes from throwing strings to<br>
throwing real exception objects. Would it be possible to skip the<br>
string one here? Are extensible exceptions too cumbersome for some<br>
cases?<br><br></blockquote><div><br>I&#39;m not sure what you mean. The main method used here *is* real exceptions. If you&#39;re referring to the failureString method, I think it&#39;s valid for simple use cases. The fact is, it&#39;s a little cumbersome (to use your terminology) to actually declare an instance of Exception. For example, if I want an exception for too many hotdogs (?!) I&#39;d have to write:<br>
<br>{-# LANGUAGE DeriveDataTypeable #-} -- needs to be at the top of the file<br>import Data.Generics -- needs to be in the import list<br>import Control.Exception -- same<br>data TooManyHotDogs = TooManyHotDogs Int deriving (Show, Typeable)<br>
instance Exception TooManyHotDogs<br><br>Maybe a good approach would be to make it easier to makes Exception types (template Haskell comes to mind). If anyone has any ideas on this front, I&#39;d be happy to hear it.<br><br>
Michael<br></div></div></div>