5 ms·
That'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 d
by elcapitan 10y ago
That'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?
- catnaroek 10y agoIn a lazy language like Haskell, you often define pure functions whose result is an effectful monadic action. In a strict language, it makes more sense to qualify functions themselves as being pure or effectful. So you end up working with Kleisli arrows, which are still related to monads. Also, the way Haskell handles composing effects (monad transformers), while precise, sometimes leaves a lot to be desired in terms of usability. That's why other approaches to managing effectful computations are being explored, like algebraic effects.
- tome 10y agoKoka tags effects using something like row types. This may very well be easier to use. There's no reason Haskell couldn't do this if it had row types, but it doesn't, so it doesn't.
- igravious 10y agoMy google-fu is not turning up any definition of `row type'. Are we talking record types here? Probably not because doesn't Haskell have a record type (much maligned though it is).
- elcapitan 10y agoThat sounds very interesting, I'll check out the modelling of those side effects, that's something I would love to understand. Thanks.
- fpoling 10y agoOne interesting application of effect types ala Koka/PureScript is that they can model type-safe private exceptions that can only be caught by code that have full access to implementation. In Haskell exceptions are unsafe and can trivially be used to subvert the type system.
- tome 10y ago> In Haskell exceptions are unsafe and can trivially be used to subvert the type system. That's news to me. Could you post a proof?