Adding an ignore function to Control.Monad
David Menendez
dave at zednenem.com
Thu Jun 11 16:45:29 EDT 2009
On Thu, Jun 11, 2009 at 4:22 PM, Henning
Thielemann<lemming at henning-thielemann.de> wrote:
>
> On Thu, 11 Jun 2009, David Menendez wrote:
>
>> On Thu, Jun 11, 2009 at 2:57 PM, Henning
>> Thielemann<lemming at henning-thielemann.de> wrote:
>>>
>>> On Thu, 11 Jun 2009, David Menendez wrote:
>>>
>>>> Again, why do you think that? I much prefer the current syntax.
>>>
>>> http://haskell.org/haskellwiki/Restrict_type_of_monadic_binding
>>> http://haskell.org/haskellwiki/Do_notation_considered_harmful#Safety
>>
>> Aside from assertions that this is a bad thing because you say so,
>> what evidence do we have that this is a problem?
>
> The example on the Wiki is ExitCode. It is commonly ignored, but it must be
> respected, since its value tells whether it makes sense to continue with
> other actions. Not a good example?
I'd ask why system is indicating failure through an exit code instead
of throwing an exception.
> I can also ask the question, what are commonly results that you like to
> ignore by default where ignoring is the right thing?
You're the one arguing for the change, not me.
The most common examples of deliberately ignoring return results are
in parsers, where you might see things like,
do pChar '('
e <- pExpr
pChar ')'
return e
And before you ask why pChar returns a result, it's because you might
do something like pChar '(' `mplus` pChar '[' and want to know which
one got returned.
> It's quite easy to add
> 'ignore' where necessary and it safes us from ignoring a result by accident.
> Avoiding errors is the goal of using types, isn't it?
If that's all there is to it, then why aren't you using Agda or Coq?
--
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>
More information about the Libraries
mailing list