8 ms·
At first glance, Elm's type system looks like it borrows heavily from Haskell [0]. Learning Haskell's type system is a great mental exercise, even if you don't
by ghayes 10y ago
At first glance, Elm's type system looks like it borrows heavily from Haskell [0]. Learning Haskell's type system is a great mental exercise, even if you don't even up coding in the language.
[0] Basics: http://learnyouahaskell.com/types-and-typeclasses http://learnyouahaskell.com/types-and-typeclasses
- catnaroek 10y agoElm's type system is a lot simpler than Haskell's. No higher kinds, no type classes, and certainly no crazy GHC extensions. OTOH, Elm has much nicer records, though Haskell sets the bar very low.
- elcapitan 10y agoIs Elm actually closer to Haskell or is it rather a typed Javascript in Haskell syntax? The documentation looks very accessible, there's a bit of introduction to the language, and then hands-on, that's nice. edit: by documentation I meant this gitbook: https://www.gitbook.com/book/evancz/an-introduction-to-elm/details https://www.gitbook.com/book/evancz/an-introduction-to-elm/d..., but the official documentation looks similar.
- catnaroek 10y agoElm has two things in common with JavaScript: strict evaluation and being designed for client-side Web development. In every other respect, Elm is closer to Haskell and diametrically opposite to JavaScript: (0) statically and strongly typed, with type inference (1) algebraic data types with pattern matching and exhaustiveness checking (2) purely functional
- elcapitan 10y agoThat's good to know. I wasn't sure if it's just a thin layer on top of javascript, or if it was stricter about this. Thanks! So the way it interacts with the dom seems to be similar to what I've read about React, in that it seems to always map the model to a view, rather than messing around with existing dom elements. That seems like something that is easy to understand and to reason about. The downside seems to be that it comes with quite a bit of js size, slightly larger than jQuery, if I understand it correctly.
- k__ 10y agoI think purescript is that. A thin layer on top ov JavaScript.
- fpoling 10y agoPureScript is a fully static strict functional language with a type system that is more advanced than that in Haskell as it allows to model all JS side-effects. It is based on the ideas for the type system in Koka [1]. That in turns allows more easily to integrate PureScript with JavaScript than Elm, but the language itself is anything but a thin layer over JavaScript. [1] - http://research.microsoft.com/en-us/projects/koka/ http://research.microsoft.com/en-us/projects/koka/
- k__ 10y agoInteresting :) When I was gathering information about typed languages that compile to JS, I found Elm rather nice, but calling JS libs was rather cumbersome. Somewhere I read that PureScript has a better integration with JS, so I thought it was a "thinner" layer :D
- pka 10y agoPurescript doesn't have a runtime, unlike Elm, so in that sense it may be a thinner layer. However, the language itself is more advanced than Elm, allowing for more powerful abstractions but also having the side effect (haha) of having the same steep learning curve as Haskell. Also, Purescript's FFI is really easy to use (unlike Elm's), afaik this was one of its original design goals.
- igravious 10y agoWhy Koka? This is not snark. Why Koka when ML and Haskell exist? What does it bring to the table that is new? What Haskell calls monads Koka calls effects? But Haskell has lazy evaluation, right -- and Koka is strict (like ML) and tracks effects (like Haskell). Does Koka complete this reductive functional programming matrix? / Monads / No monads† ----------------------- S | Koka | ML L | Haskell | Miranda † No monads == Nomads?
- bootload 10y ago(3) immutability ~ https://www.google.com/search?q=elm-lang.org+immutabilty https://www.google.com/search?q=elm-lang.org+immutabilty
- bootload 10y ago"At first glance, Elm's type system looks like it borrows heavily from Haskell" I stumbled on Elm looking for a good language (Haskell) to build a new language. Try compiling Elm. hint: it's written in Haskell and if you squint, the type system is a simpler derivation of Haskell.