<div dir="ltr"><br><br><div class="gmail_quote">On Mon, Oct 26, 2009 at 6:19 PM, Darrin Thompson <span dir="ltr"><<a href="mailto:darrinth@gmail.com">darrinth@gmail.com</a>></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 <<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>> wrote:<br>
> Comments are most welcome. I would like this to be a suitable replacement<br>
> for the ubiquitous Maybe, (Either String) and ad-hoc Result data types so<br>
> often used to report a failure. I'd be very happy to improve the package for<br>
> the general community.<br>
><br>
<br>
</div>I haven'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'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 "string as exception" 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'm not sure what you mean. The main method used here *is* real exceptions. If you're referring to the failureString method, I think it's valid for simple use cases. The fact is, it'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'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'd be happy to hear it.<br><br>
Michael<br></div></div></div>