
Evan Laforge wrote:
Can you give a specific example? I'm trying to think of how this is different from the normal exceptional escape mechanism. I use Either as a Maybe + info all the time, but I think you're talking about something more sophisticated here.
No something very simple.
Here's a contrived example that computes the number of days in a month:
Oh, right, good point. Yeah, that error superclass requirement is grody, you'd have to make an Error Int instance with a bogus noMsg value. Error is there only for Control.Monad.fail, which everyone agrees lives up to it's name, right? I've had to define a number of 'noMsg's, and every time I've picked some random bogus value because there was no appropriate definition, and never actually seen that bogus value pop out, but was always sort of nervous it would come bite me someday. I know this is getting off subject some, but are there are official proposals up to either remove pattern matches on the left side of <-, or treat them like failures in 'let' and throw an error? I've found refutable matches in listcomps very useful, but I've never had a use for them in any other monad, and anyway listcomps are no longer considered just another syntax for monads so they don't need to follow the same rules. I'd be comfortable with refutable matches being a special feature of listcomps and in all other contexts be an error if it let us get rid of 'fail' and 'Error'.