3 ms·
C is also pure. After all, C code is just data until it gets compiled and executed. When and how often this happens is irrelevant. You could write a C interpret
by ambrop7 14y ago
C is also pure. After all, C code is just data until it gets compiled and executed. When and how often this happens is irrelevant. You could write a C interpreter in Haskell, and then your C code would be as pure as anything else in Haskell!
- loup-vaillant 14y agoThat doesn't do monadic I/O justice. An IO value in Haskell is a first class value. Your typical C instruction is not.
- kenko 14y agohttp://conal.net/blog/posts/the-c-language-is-purely-functional http://conal.net/blog/posts/the-c-language-is-purely-functio...
- Chattered 14y agoUnless you are conal, himself, I demand an acknowledgement! http://conal.net/blog/posts/the-c-language-is-purely-functional http://conal.net/blog/posts/the-c-language-is-purely-functio... 1 minute behind kenko! :P
- jeffdavis 14y ago"When and how often this happens is irrelevant." Why do you say that?
- ambrop7 14y agoBecause it's an implementation thing, it has no relevance from a theoretic view on the language. It's like the "compiled/interpreted" label.
- jeffdavis 14y agoI'm not an expert, but my understanding is that IO is not necessarily run even if an expression is evaluated that produces a value of type "IO a". That is a theoretical difference, not just an implementation detail.
- ambrop7 14y agoI just made that argument up, didn't know about Conal's post, thanks for the link!