Fwd: Monads, do and strictness

`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.
Implicit use of laziness or undefined to model and reason about data or
algebras is a mistake that mixes semantic layers. Even in Haskell. There's
a reason every robust library for processing signals or streams will model
them explicitly.
Regards,
Dave
On Sat, Jan 21, 2012 at 11:22 AM, Roman Cheplyaka
* David Barbour
[2012-01-21 11:09:43-0800] 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 'undefined' is not a value in the domain indeed, but it is in non-strict languages, exactly because they are non-strict.
I think that's what Robert Harper meant by saying that Haskell doesn't have a type of lists, while ML has one [1].
[1]: http://existentialtype.wordpress.com/2011/04/24/the-real-point-of-laziness/
-- Roman I. Cheplyaka :: http://ro-che.info/

* David Barbour
`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. 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. Now, 'undefined' is certainly a legal Haskell expression. If you don't like exceptions, let's define 'undefined' as (let x = x in x). Hence you need to have some element in your domain corresponding to 'undefined'. -- Roman I. Cheplyaka :: http://ro-che.info/
participants (2)
-
David Barbour
-
Roman Cheplyaka