4 ms·
It's really too bad that Haskell, with it's referential transparency, doesn't have a way to rewrite things programmatically (well, none that I know of). Rewriti
by Dewie 13y ago
It's really too bad that Haskell, with it's referential transparency, doesn't have a way to rewrite things programmatically (well, none that I know of). Rewriting terms would be great in a language like that. It seems that when a typeclass has some laws, and you want to show that an instance of it obeys the laws, you have to bust out the pen and paper. Nothing wrong with that, but it seems like a language like that could support computer-aided rewriting.
Then there are languages whose evaluation is based on term rewriting, like the language Pure.
EDIT: You do have HLint, and the bot that rewrites expressions to point-free style.
- charlieflowers 13y agoI agree that functionally pure code could allow for amazing programmatic rewriting. Imagine coupling that with homoiconic syntax. Not necessarily to have Lisp-style macros, but rather so you could offer repl-based programmatic rewriting/refactoring tools, where the tools know that your code is pure and thus can be "reasoned about mathematically."
- jerf 13y agoIt's close: http://www.haskell.org/ghc/docs/7.0.1/html/users_guide/rewrite-rules.html http://www.haskell.org/ghc/docs/7.0.1/html/users_guide/rewri... I acknowledge that is not precisely what you were referring to, but it is close.