[Haskell-cafe] Alternative IO

David Menendez dave at zednenem.com
Fri Jul 17 10:47:21 EDT 2009


On Fri, Jul 17, 2009 at 10:21 AM, Wolfgang
Jeltsch<g9ks157k at acme.softbase.org> wrote:
> Am Freitag, 10. Juli 2009 23:41 schrieben Sie:
>
>> Additionally, the second equality you provide is just wrong.
>>
>> f *> empty = empty is no more true than f *> g = g,
>
> I don’t understand this. The equation f *> g = g is much more general than
> f *> empty = empty. (<|>) usually denotes non-determinism and empty should be
> the neutral element of non-determinism, which is failing. This leads me to
> f *> empty = empty.

That's too strong, unless you want to restrict Alternative to
applicative functors with reversible side-effects.

It's generally accepted that LogicT IO is an instance of MonadPlus, but

   liftIO (putStrLn "effects!") >> mzero /= mzero

I would expect LogicT IO to be an instance of Alternative as well.

-- 
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>


More information about the Haskell-Cafe mailing list