4 ms·
This is an extreme exaggeration, but it illustrates the point that a C programmer writes some source code that produces effects only at runtime and the compiler
by dmytrish 12y ago
This is an extreme exaggeration, but it illustrates the point that a C programmer writes some source code that produces effects only at runtime and the compiler may be thought of as a pure function (though, with a bit of external state, but that is manageable in Haskell too).
The point is, it is the runtime system that produces the side effects, just as Haskell RTS does; the only difference is that Haskell annotates effects with its type system.
On the other hand, it completely blurs the line between "pure code" and "effectful code". Though the definition of "pure code" is rather tricky (we used to it in the Haskell meaning, with memory management completely abstracted away and explicit signatures of side-effect presence), but what's the point of a term that applies to all source code in existence?
- robzyb 12y ago> the only difference is that Haskell annotates effects with its type system. I kind of disagree. Haskell doesn't only annotate effects with its type system. Haskell goes much further than that. It encourages an explicit and clear split between purely-function code and side effects. But what do I know? Despite reading about it a lot, I've never written any Haskell ;)
- dmytrish 12y agoHaskell does [partial?] type erasure, so RTS often knows nothing about types, it can't distinguish a pure function from any other one. The type consistence and runtime correctness is assured by the typechecker at compile time.
- tel 12y agoTotal type erasure, at least ignoring `Typeable`.