4 ms·
It's hard to compare JS to Haskell without mentioning the JS's complete lack of a type system... That said, if you want something more ML-like in your JS, Flow
by namuol 10y ago
It's hard to compare JS to Haskell without mentioning the JS's complete lack of a type system...
That said, if you want something more ML-like in your JS, Flow is an increasingly-viable option: https://flowtype.org/ https://flowtype.org/
- behnamoh 10y agoI think as a beginner, I need to start w/ "standards" first. I mean, shouldn't I first know JS to understand Flow? Wouldn't learning FlowType put me in a corner where I don't have all the support of JS community?
- djfm 10y agoStarting with standards is probably good yes. Something I found very helpful in JS is doing hard-core TDD at least at first (again, the tooling is awesome, see mocha, chai) - then after having done the same thing a hundred times you can become more relaxed. Good unit tests make up for a lot of missing types.
- djfm 10y agoYeah, I've been experimenting with it for a few days and I find it very promising. But the lack of types in JS is not such a pain point IMHO. In JS you can define a monad that works only with numbers, which is sometimes useful, and which you cannot do in Haskell without black magic. I think Flow's idea is that most JS programs are actually naturally well typed, and it often verifies in practice. Just because you don't have a compiler yelling at you doesn't mean your program is not well typed :)
- djfm 10y agoThat being said I cannot wait for the time when Haskell becomes truly mainstream in web development.
- tome 10y ago> In JS you can define a monad that works only with numbers, which is sometimes useful, and which you cannot do in Haskell without black magic. What does this mysterious assertion mean?