5 ms·
> The advantage of "the Haskell Way" is that most of those unit tests don't exist in code; they're implicit in the type system... This is very powerful "mantra
by dschiptsov 12y ago
> The advantage of "the Haskell Way" is that most of those unit tests don't exist in code; they're implicit in the type system...
This is very powerful "mantra" indeed, and millions "believe". I am not trying to say that The Haskell Way is worse or better (Java way is worse indeed), all I am trying to say is that, in my opinion, everything "interesting" in Lisps begins with an ability to define a new special form as a macro to extend the language.
Arc language and this site championed this approach to implement complex systems as layers of DSLs embedded in Lisp - the code of arc.arc and news.arc is indeed layers of macros built out of another macros, in accordance with principles described in On Lisp book.
This is in some sense an opposite to The Haskell Way you have described above. It is not better or worse, it is very different and has its own beauty and elegance (and Haskell has its own, especially these either-of and one-of types).
You see, as long as a tiny doing-a-single-thing Arc procedure or a marco (the basic building block) runs correctly in REPL, it will run correctly later - as long as it is free of side-effects - no unit test required (it is not Python or Ruby).
The real difference, is that in Haskell you cannot pass a wrong arguments to a procedure - you will get a compile-time error, while in Arc you could and will get a run-time error.
"Lisp people" it seems, "believe" in really quick prototyping, exploratory programming (on-the-go), like PG named it, while "Haskell people" believe in careful planning in advance and "safety" of double-checks.
I would say that in reality, in mountains, for example, planing in advance almost never worked - you will never cover all the possible scenarios, but making decisions quickly, on the go, adapting to constantly changing conditions of high altitude saves lives and leads to the summits. This is why, perhaps, I am "Lisp person". For me, "safety" comes from flexibility (ability to change/respond quickly), not from any "guarantees".
- dllthomas 12y agoI would really recommend you learn more Haskell, because your generalizations of it seem wrong - Haskell programming is often exploratory. What the types give you (used right) is another view into the ramifications of your changes. Haskell also has a repl (ghci), and it's quite useful - it will not only tell you the result of running some code, but will also tell you the shape of code you can't run yet! Meanwhile, those double-checks help tremendously when planning fails, because they show you quickly what needs to change when you change your assumptions. Deep thought and planning can help you in either language - but they're more required when you can't see what breaks with changes.