I moved from React/Redux/Typescript to Elm a few months ago, and I'm now on my second serious project with it, making mobile application with Cordova. I've found it an absolute pleasure to use, and I especially like that you can be pragmatic about it; if there is something that is annoying to do in Elm then you can simply drop into Javascript/Typescript using ports.<p>Coming from languages like Actionscript/Javascript/Typescript/PHP I have found the whole Elm experience quite mindblowing; if it compiles, then it just seems to work. I hardly ever find myself poring over bits of code trying to debug a subtle error, and if I do the problem is going to be in the Javascript/Typescript bit.<p>Basically, I'm sold :)
I am happy to see Elm evolving and it looks like a good framework, but there is a tendency in FRP articles to ignore prior work, as acknowledged at the end of the article:<p>> Note: Interested readers may find Lucid Synchrone interesting. Unfortunately for me, I had no idea my thesis had so much in common with synchronous programming languages at the time, but the connections are quite striking. I might argue that Elm was never about FRP.<p>My thesis was related to synchronous programming languages and articles about FRP tend to have too little to say about them, for my taste. Yes, there is a word or two in the related work, but also it looks like some wheels are being reinvented.<p>The subscriptions model reminds me of Esterel, which is imperative and uses await/emit pairs.
In the domain of GUIs, which is related to Elm, there is ReactiveML (see "ReactiveML, Ten Years Later" (<a href="https://www.di.ens.fr/~pouzet/bib/ppdp15.pdf)" rel="nofollow">https://www.di.ens.fr/~pouzet/bib/ppdp15.pdf)</a>).
Look also at Lustre or Signal, with Signal allowing directives to define multiple execution units: this is used to generate concurrent programs exchanging values with message passing.<p>The domain is different, though. Synchronous languages do not target web interfaces. They are about embedded systems and as such, they are mostly static. On the other hand, they are compilable into a simple event loop with static memory usage and constant execution time.
Maybe some of the existing research could be useful to something like Elm, even if it does not target the same problems.
As someone who is just getting started with frontend development, I decided to go with Elm instead of learning JS and React. I found the whole experience very pleasant, even as a beginner.<p>Not only is the elm code I write reliable, but I've found that adding more features does not bloat my code. Refactoring a codebase as it grows in elm is pleasant, and following the Elm Architecture guides me on the correct structure for the app.<p>Over the weekend I made a small site to show all Elm conference videos in one place.
If you want to play around with 0.17 this project is just a bit above a "Hello World" example. Send a PR!
<a href="https://elmvids.groob.io/" rel="nofollow">https://elmvids.groob.io/</a>
There's also a lot of similarity with Rx.JS and observable based (aka "Reactor") patterns:<p><pre><code> Rx.Observable.fromTime().subscribe(tick)
Rx.Observable.fromSocket(mySocket).subscribe(handleEvent)
</code></pre>
<a href="https://github.com/Reactive-Extensions/RxJS" rel="nofollow">https://github.com/Reactive-Extensions/RxJS</a><p>Regardless of the exact library or pattern, the broader concept of treating data sources as asynchronous event streams you can subscribe and react to definitely simplifies data flow and makes systems very robust.<p>An additional benefit of this pattern is the natural way it makes it easy to filter, chain, map, etc onto these subscriptions. Once again from the Rx world, <a href="http://rxmarbles.com/" rel="nofollow">http://rxmarbles.com/</a> does a great job visualizing these patterns.
This looks very cool.<p>In ClojureScript, we have the re-frame pattern/framework, which is built on Reagent, which is a ClojureScript wrapper of React.<p>re-frame is all about subscriptions, using a "big atom" to hold application state client-side. Seeing Elm implement the same subscription pattern makes it look pretty tempting.<p>My understanding is that ClojureScript and Elm have some similarities - functional, pleasant to work with - with one significant difference being that Elm is typed.
Congrats to Evan. I'm still learning Elm and it has been such a pleasure. It's so much clearer to understand the code and go back to it later.
I spoke with Evan at length at one of the regular Elm "hackathons" in SF and was so impressed how he thinks about long-term vision of Elm and prefers to take his time to ensure he gets it right to make Elm be around for a long while. Which is the reason I'm investing time into Elm.
If you're in SF Bay area. Tomorrow (Wed) is the next Hack night a great place to talk to Evan and the small community around it.
I like Elm but its development really seems to rely on a single person. I saw this post on elm-discuss which is a pretty good summary of my thoughts <a href="https://groups.google.com/forum/#!topic/elm-discuss/AmxE3qAmtvE" rel="nofollow">https://groups.google.com/forum/#!topic/elm-discuss/AmxE3qAm...</a>
Since people in this thread are likely to be elm enthusiasts and know what's going on in the ecosystem, what is the largest high quality elm app you know about and what is the largest high quality elm app that is open-source that you know about?<p>I've been doing backend work for a while and I'd like to see what is possible these days with elm.
I'm super excited for this change. I've been watching and waiting for a few weeks. It's a big ordeal for me personally, because I've got 10 weeks of daily elm tutorial content I've written so far at <a href="http://dailydrip.com/topics/elm" rel="nofollow">http://dailydrip.com/topics/elm</a> that I'm now re-writing, but the changes are all for the better and the language adoption is bound to go up over time.<p>If you haven't yet tried Elm, give it a shot. A co-worker (hi Heath!) showed it to me 4(?) years before I got interested in it, and I brushed it off as a toy because I was against Functional Programming at the time for terrible reasons. It's actually one of the 'this feels like the future' technologies that's re-shaping how I think about programming these days. Huge kudos for the release!
I haven't dabbled in Elm much, but subscriptions look a lot like ordinary JS event handlers:<p><pre><code> Time.every second Tick
</code></pre>
vs.<p><pre><code> Time.on('everySecond', tick)
</code></pre>
Beyond baking an event emitter into the Time module and having a nice looking API, is there something I'm missing?
What I really want is a language with Elm's type system, simplicity, and syntax, but aimed for backend software instead of HTML apps and with strong support for an Erlang-style actor model of multicore, distributed concurrency. Basically something like Elixir, but with Elm's syntax and type safety. In the meantime Elixir will do for me, but I'd really like more type safety without going full Haskell.
There is a nice talk from Erlang Factory 2016 called<p>"Making the Web Functional with Phoenix and Elm"<p><a href="https://www.youtube.com/watch?v=XJ9ckqCMiKk" rel="nofollow">https://www.youtube.com/watch?v=XJ9ckqCMiKk</a>
Just out of curiosity. I'm trying to decide which client-side framework/language to dive into, and it seems that many people consider Om Next a really nice step forward, away from "giant blob of state". My (uninformed) observation is that Elm does things the way Om (previous) did it: is that correct? Is Elm aiming to incorporate Om Next's advantages?
Say what you will about languages that compile to JS, but Elm code looks so <i>elegant</i> that I just want to use it for aesthetics alone. Major kudos to Evan for such a wonderful and powerful creation.
From the Lucid Synchrone paper referenced in the article:<p>"Synchronous languages are based on the synchronous hypothesis. This hypothesis comes from
the idea of separating the functional description of a system from the constraints of the architecture on which it will be executed. The functionality of the system can be described by making
an hypothesis of instantaneous computations and communications, as long as it can be verified
afterward that the hardware is fast enough for the constraints imposed by the environment."<p>That sounds a lot like how functional programming works in a browser. If you assume function calls take zero time (or can be optimized so they're fast enough) then you end up with event handling and asynchronous I/O. Preemptive multitasking becomes a non-issue. But long-running computations (where you actually want to keep some CPUs busy for a while) need to be handled outside the system.
I got into studying FRP around 3 years ago for my senior project. Aside from a decent, clear explanation, there were hardly any actual implementations of this allegedly good paradigm (something Evan covered in his thesis, and the basis for Elm). It seemed like a paradigm that was full of promise and potential but failed to deliver in any worthwhile way.<p>(Such was the case for my senior project, studying the viability of Arrowized FRP in Elm. In short, I concluded that it was nothing but hell and nobody should bother.)<p>I am happy to seem Elm drop FRP, even if I wished it could be the savior of the method. At this point I think it's a troubled concept and should be limited to old theses.
Woah, still reading but seems like a big change considering FRP was somewhat fundamental to Elm.<p>[edit] Looks like a solid change driving Elm towards easier usage, Signals and Mailboxes were definitely something that took a while to wrangle correctly.
Elm is very cool and pleasant to use compared to JavaScript, but I have some reservations. The limited typeclass system (for numbers and such) seems... questionable. The interaction of what looks like pure declarative syntax and what is actually impure imperative semantics is confusing to me. I understand that the author wants to avoid monads and other perhaps somewhat confusing staples of functional IO, but I'm not sure the cost/benefit of doing it this way works out.<p>I will say that Elm is the best JavaScript-targeting platform I have tried! I have hopes for GHCJS, but it's not near Elm's level of readiness yet.
I found that while things worked once it compiled, I spend most of my time staring at compilation errors, especially as I refactored. So I'm mostly trading time spend debugging subtle state errors with fixing compile type errors. It <i>feels</i> not as productive, since I'm usually looking at errors.<p>Also, I'm still new to FP, so if you go outside of the Elm architecture, you're going to run into problems, which you're use to solving with specific tools, but they won't be available. So you'll have to spend time learning how to compose things in a new way.
Elm has always been "that language I dabble in every now and then but never have time for"... good to see it's evolving. Evan and Richard (creator and main evangelist, respectively) are a great team and I hope them the best (and I hope I get more time to mess around with Elm!).
Wow, this is a surprise. Kind of like a Haskell headline "A Farewell to Immutability". But sounds like the pros and cons have been well thought out for the intended use case.
One thing I'm wondering with elm is how does it deal with state across different components? I.e. where would you put the settings of the current user and how would you access that within one component? (By component I mean the (init,update,view,subscription))
Hey! CodeHS is working on an Elm Course. The vision of the course is to make a more approachable version of SICP.<p>The course is still in development, but let us know if you're interested!<p><a href="https://codehs.com/info/curriculum/elm" rel="nofollow">https://codehs.com/info/curriculum/elm</a>
> A web handler threw an exception. Details:<p>> gen/pages/blog/farewell-to-frp.html: getFileStatus: does not exist (No such file or directory)<p>Some caching problem, it seems?
So, is it still true to say, "You wish you could express your business logic with pure functions. But often you can't because the lack of immutability hurts performance in various ways. But ELM creates a 'sandbox' in which you <i>can</i> do so, by letting you write functions which work over time varying streams instead of stateful callbacks."<p>If not, which parts changed / how would you revise it?
Has the elm installation on Linux improved in recent months? Last time I tried my system's GHC was too new to install it from source and the node installation went kablooey in weird parts(too recent ncurses, the automatic "reactor" browser repl not finding the Html package etc...)
For those like me who aren't familiar with Elm:<p>An Introduction to Elm<p><a href="https://www.gitbook.com/book/evancz/an-introduction-to-elm/details" rel="nofollow">https://www.gitbook.com/book/evancz/an-introduction-to-elm/d...</a>
The chat client thing is pretty interesting, but there's this little bit:<p>> Use the browser API — To get started you just create a new web socket! Well, then you need to open the connection. But do not forget to add an onerror listener to detect when the connection goes down and try to reconnect with an exponential backoff strategy. And ......<p>How does handling errors happen I wonder. If you take FB messenger for example, you would queue up a message but if the sending failed you would get an opportunity to retry/not send it at all.<p>I suppose in FB's case you could write your own subscription provider...
Say a magazine company wants to regularly send issues to a customer, and the customer signs up. Who has the subscription, the customer, or the magazine company? Which one subscribes?<p>According to Rx, it's the magazine company. Which one subscribes? The magazine company subscribes. It took me a while to realize this when trying to learn Rx concepts, which made it really confusing, since I've always seen the customer as being the subscriber, subscribing and owning the subscription.<p>It looks like Elm is the other way around compared to Rx, I think.
FRP = Functional Reactive Programming<p>> When I started working on my thesis in 2011, I stumbled upon this academic subfield called Functional Reactive Programming (FRP). By stripping that approach down to its simplest form, I ended up with something way easier to learn than similar functional languages. Signals meant piles of difficult concepts just were not necessary in Elm.
FOAM is also subscription based, but then builds FRP on top of it:
<a href="https://www.youtube.com/watch?v=-fbq-_H6Lf4" rel="nofollow">https://www.youtube.com/watch?v=-fbq-_H6Lf4</a>
Can someone explain how the subscription API differs from signals, addresses, and ports? I'm not familiar with the "old" Elm so I can't judge what the change is like.
Looks like Elm moved closer to Pux's API by dropping the signals for `Html action`. Check out Pux if you're interested in the same architecture but for PureScript.<p><a href="https://github.com/alexmingoia/purescript-pux" rel="nofollow">https://github.com/alexmingoia/purescript-pux</a>
subscriptions are great for handling black hole callbacks - callbacks that you cannot return back control to the callie.<p>Examples of this would be web-socket , http-requests , etc.<p>however elm and cycle.js try to shoe-horn this idea everywhere - which I think is not needed.<p>Not every event needs to be subscribed to - it pollutes your global stream. Use global stream only when you need to deal with things that move out the execution context of your program.
Doing away with signals is a great move, everything else about the elm architecture felt so intuitive.<p>I'm excited to give elm another shot, and I yearn for the future he describes where web assembly makes elm a viable js replacement.
Looks very good. I got stuck learning elm at about the point I wanted to integrate a call to a javascript function. Can't for the life of me remember if that involved signals or not. Will definitely try the tutorial(s) again when I get some more time because I really was enjoying everything else about the language and developing in it.