[Haskell-cafe] Fwd: Monads, do and strictness
David Barbour
dmbarbour at gmail.com
Sat Jan 21 23:58:29 CET 2012
On Sat, Jan 21, 2012 at 2:24 PM, Roman Cheplyaka <roma at ro-che.info> wrote:
> * David Barbour <dmbarbour at gmail.com> [2012-01-21 12:18:09-0800]
> > `undefined` is not a value in any domain. It isn't a value at all. It's
> > certainly not part of my monad language or algebra. Up to the semantic
> > level of comparing observable and legally defined behaviors, we can have
> > the identity law. That's sufficient for the letter of the law, even if
> not
> > ideal from Haskell's operational perspective.
>
> First, can we please agree on what kind of semantics we are discussing?
>
> In the beginning you are talking about domains, so it sounds like
> denotational semantics. But then you move to behaviours, and that sounds
> like operational semantics.
>
Can you first agree what *layer* of semantics you are discussing? It's
useful to understand programs in layers. Your argument seems to depend on
confusing the semantics of the monad abstraction with the semantics of the
Haskell representation of the abstraction.
We could even look at underlying layers, such as the implementation of
Haskell - including allocation and GC. The important point is that the ONLY
relevant layer for monad laws is the monad algebra itself - not the
representation in Haskell, and certainly not the representation of Haskell
on a Von Neumann machine. Since strictness does not affect the *values* of
any elements in the monad's algebra, it is trivial to meet the monad laws.
My argument did switch from denotational to operational as I crossed
layers, but that was a conscious decision on my part.
> If we are talking about the denotational semantics, then we choose a
> domain and need to map every legal Haskell expression to something in
> that domain.
>
We can discuss denotational semantics of many languages. And we can discuss
the representations of those languages in Haskell. And we can discuss the
denotational semantics of Haskell. Layers upon layers. Denotational
semantics certainly doesn't imply the Haskell layer.
Regards,
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120121/ebc510f9/attachment.htm>
More information about the Haskell-Cafe
mailing list