[Haskell-cafe] Monads, do and strictness

David Barbour dmbarbour at gmail.com
Sun Jan 22 17:25:11 CET 2012


> observably different from `undefined`

If we understand `undefined` as meaning a computation that never ends, then
you cannot ever observe whether one `undefined` is or is not equivalent to
another. In strict languages, this is especially obvious.

In any case, I don't accept a concept of `monads` that changes so
drastically based upon the host language. The laws for monads only apply to
actual values and combinators of the monad algebra - and, since `undefined`
is not a value, it need not apply. Similarly, algebraic laws for integer
arithmetic don't need to account for `undefined`. And our geometry
abstractions and theorems don't need to account for `undefined`.

Attempting to shoehorn `undefined` into your reasoning about domain
algebras and models and monads is simply a mistake.

Regards,

Dave

On Sun, Jan 22, 2012 at 6:49 AM, Sebastian Fischer <fischer at nii.ac.jp>wrote:

> On Sat, Jan 21, 2012 at 8:09 PM, David Barbour <dmbarbour at gmail.com>
> wrote:
> > In any case, I think the monad identity concept messed up. The property:
> >   return x >>= f = f x
> >
> > Logically only has meaning when `=` applies to values in the domain.
> > `undefined` is not a value in the domain.
> >
> > We can define monads - which meet monad laws - even in strict languages.
>
> In strict languages both `return undefined >>= f` and `f undefined`
> are observably equivalent to `undefined` so the law holds.
>
> In a lazy language both sides might be observably different from
> `undefined` but need to be consistently so. The point of equational
> laws is that one can replace one side with the other without observing
> a difference. Your implementation of `StrictT` violates this
> principle.
>
> Sebastian
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120122/02a9d115/attachment.htm>


More information about the Haskell-Cafe mailing list