2 ms·
> Non-termination is an effect While this is more of a philosophical than factual contention, that is as ridiculous as saying "the reduction of `(λx.x)4` is an
by wyager 10y ago
> Non-termination is an effect
While this is more of a philosophical than factual contention, that is as ridiculous as saying "the reduction of `(λx.x)4` is an effect". Non-termination is a property of a computation, not something that a program does to the outside world. The fact that, in Haskell, certain forms of non-termination "do something" to the computer is a consequence of the fact that real-world computers aren't actually turing machines or ideal lambda reduction machines, and sometimes the abstraction falls apart. There's nothing wrong with letting a computer churn away forever trying to reduce a divergent expression (with no effects!), but we just choose not to for practical reasons.
- tome 10y ago> Non-termination is a property of a computation, not something that a program does to the outside world You seem to be suggesting that IO is the only effect. State, Writer and Either are effects but they don't do anything to the outside world.
- catnaroek 10y ago> that is as ridiculous as saying "the reduction of `(λx.x)4` is an effect". What I'd do is consider the use of recursion to put your computation in a partiality monad. The identity function isn't recursive, so `(λx.x)4` is a pure computation. I'd also require a positivity check on recursive datatypes, to prevent users from sneaking nontermination into pure functions via datatype constructors. > Non-termination is a property of a computation, not something that a program does to the outside world. Non-termination gets in the way of producing a result, so it's an effect. > There's nothing wrong with letting a computer churn away forever trying to reduce a divergent expression (with no effects!) I wouldn't call it “wrong” either, because effects aren't intrinsically “wrong”.