12 ms·
Small Assets without the Headache in Elm 0.19
- thedanabrams 8y agoIt’s been a long time coming but this is great. Thanks to everyone on the Core Team, and especially Evan, for their hard work. Can’t wait for what comes next, especially, hopefully, some interesting things in Elm-Explorations.
- antew 8y agoI'm so glad to see this, congrats to Evan and everyone who helped get 0.19 out the door! I've been working in Elm for about a year now and it is a joy to work with, moving from vanilla JS/Angular/React to Elm has been a boon to productivity and I actually have confidence that when I refactor something and have fixed any compiler errors that it is going to work.
- eksemplar 8y agoWe had a lot of trouble doing things without typesafety and declarations, so we tried a few things. Elm was one of the better ones, and we migrated a few minor systems to it. A few others to typescript and we even made a few pocs with Xamarin and Wasm. Then one of my older employees randomly watched “JavaScript the better parts”, and recommended it to me and we’ve been doing classless JavaScript ever since. Elm is great, certainly one of the better alternatives, but now it really feels like a step backwards.
- spuz 8y agoWhat is classless JavaScript? I don't understand how you had trouble doing things without typesafety but found that going from JavaScript to Elm is a step backwards? Maybe I'm missing something here?
- digitalzombie 8y ago> What is classless JavaScript? Sounds like old school javascript. Either just functional programming or prototype inheritance.
- eksemplar 8y agohttps://web.archive.org/web/20151029152324/http://ericleads.com/2013/01/javascript-constructor-functions-vs-factory-functions https://web.archive.org/web/20151029152324/http://ericleads.... https://weblogs.asp.net/bleroy/crockford’s-2014-object-creation-pattern https://weblogs.asp.net/bleroy/crockford’s-2014-object-creat... Once you start doing this, most other languages become obsolete. Because you avoid most of the problems of JS that things like elm try to fix, while maintaining the freedom and also writing a lot less code because you don’t have to write a “recipe” for half the things you write. The disadvantage of JS is that it’s actually going in the wrong direction. Class is an attempt to copy C-style languages, and that really what you don’t want to do, because as soon as you use inheritance, the “this” keyword or “new” you’re basically doing JAVA/C#/whatever with all the downfalls of JS.
- ww520 8y agoThat's not classless. It's just class using factory instead of constructor for object instantiation.
- boubiyeah 8y agoJS vs Elm simply cannot be reduced to "classes". Classes is only a tiny part of what's broken in JS. TS (coupled to "JS, the good parts") saves the day though, but I have no idea how avoiding classes also somehow made you abandon the usage of a type system (whether Elm's or TS's) It all seems so unrelated.
- tomtheelder 8y agoMany people (myself included) have never meaningfully used the OOP elements of JS you are referring to. The approaches listed above are common JS patterns and ones that I and I think most JS devs have used extensively. However, they don't really solve any of the problems that Elm sets out to try and tackle. Do you have any examples? Also these patterns certainly do not make any other languages obsolete, and as far as I'm concerned it doesn't solve _any_ of the problems with JS that people complain about.
- leshow 8y agoYour comparison doesn't make any sense. You would use a language like Elm/Purescript/Reason etc for the type safety, that's completely orthogonal to whether something has classes or not.
- pbowyer 8y agoI had to find out: this is Douglas Crockford on it: https://youtu.be/DxnYQRuLX7Q?t=2734 https://youtu.be/DxnYQRuLX7Q?t=2734
- jxxcarlson 8y agoJust wanted to say what a joy it has been to work with the 0.19 compiler. For the project at https://knode.io https://knode.io, it was a game-changer: the elm/parser library is so fast that it makes live rendering of LaTeX to HTML a reality. See - Demo: https://jxxcarlson.github.io/app/miniLatexLive/index.html https://jxxcarlson.github.io/app/miniLatexLive/index.html - Blog post: https://medium.com/@jxxcarlson/elm-0-19-its-parser-and-minilatex-606838dc5645 https://medium.com/@jxxcarlson/elm-0-19-its-parser-and-minil... Many thanks to Evan for this amazing release. The wait for it was very much worth while. Faster compiling, smaller asset size, and more. Yay!!
- jxxcarlson 8y agoOne more point. Writing something like the MiniLatex parser would be somewhere between impossible altogether and nightmarish without an expressive type system. Below is the definition of the type of the abstract syntax tree (AST) for MiniLatex. Just eleven lines of code. Yes, I know. No typeclasses in Elm. But Elm's type system is surprisingly expressive, and with it one can do some rather sophisticated work. I've been very happy with it. type LatexExpression = LXString String | Comment String | Item LatexExpression | InlineMath String | DisplayMath String | SMacro String (List LatexExpression) (List LatexExpression) LatexExpression | Macro String (List LatexExpression) (List LatexExpression) | Environment String (List LatexExpression) LatexExpression | LatexList (List LatexExpression) | LXError (List DeadEnd)
- dsiegel2275 8y agoCongratulations! I don't use Elm in production (yet), but have been following it's evolution for the past few years, built a few small side projects with it, and have gotten the chance to attend both Elm conferences. What a great community and great piece of technology.
- ronkwan 8y agois it just me? i thought this old school email client is getting an update after a decade?
- revskill 8y agoHow about server-side rendering ?
- joneil 8y agoOne possible approach is talked about in the latest Elm-town podcast: https://elmtown.audio/the-risk-of-elm-dhruv-dang https://elmtown.audio/the-risk-of-elm-dhruv-dang
- subbz 8y agoSeeing that and liking Elm I have to tell that GatsbyJS (https://www.gatsbyjs.org/ https://www.gatsbyjs.org/) outputs really fast end-products. Is that possible with Elm too?
- lsjroberts 8y agoGatsby produces static html sites and then rehydrates them once loaded, which is what makes it feel so fast. Elm dynamically generates the html. There has been some work to generate static html from Elm - https://github.com/eeue56/elm-static-html https://github.com/eeue56/elm-static-html - and there's no technical reason I'm aware of that prevents it from being taken as far as Gatsby does.
- SupremumLimit 8y agoI've been doing some work on an Elm-based static site generator: https://korban.net/elm/elmstatic/ https://korban.net/elm/elmstatic/ (It uses elm-static-html under the hood.)
- doctor_stopsign 8y agoCongrats on the release! I have very high hopes for Elm in the future, and I think it truly shifts the paradigm of frontend development. On an attempt to use Elm in production I ended up switching back to Javascript. The biggest issue I faced was lack of type-classes, which made certain parts of the code feel like I was pulling teeth to get Elm's type system to be happy. Perhaps this is more of an issue of expecting Elm to be more like Haskell than it is. I hope Elm is able to get more adoption, and with it more examples of idiomatic approaches to problems in Elm's style. However this somewhat feels like a chicken-and-egg problem. Regardless, this release looks great for people using it in production already!
- rtfeldman 8y ago> this is more of an issue of expecting Elm to be more like Haskell than it is. Yep, that's it right there. I wonder if there's some way we could make it clearer that Elm is not Haskell, and trying to use it like it's Haskell won't likely to lead to a good experience. At any rate, thank you for the feedback! It's definitely an ongoing communication challenge since the two languages have so much syntax in common.
- pdamoc 8y ago> Perhaps this is more of an issue of expecting Elm to be more like Haskell than it is. Some people have a hard time in Elm because they expect Elm to behave like a language that they are already familiar with. The most frequent impedance mismatch issues I've seen are reaching for `type-classes` or attempting to implement various polymorphic behaviors and people who are too hungover on imperative constructs (Elm is declarative). Once people start using Elm the way it was designed to be used, things become simple and start to flow.
- undreren 8y ago> Once people start using Elm the way it was designed to be used, things become simple and start to flow. But how will anyone ever get anything done, when they can't make everything in their code exceptionally clear by wrapping it all up in a 15 monad thick monad-combinator? /s But yes, I totally agree. Elm is a simpler, safer and easier Haskell for the front-end. I just love it :)
- patsall 8y agoThe real Elm has been at version 2.5.8 for many years. Why didn't these guys pick a name not already used by a famous piece of software?
- dnh44 8y agoI was confused as well. I thought surely Elm must have reached a v1.0 release by now.
- salimmadjd 8y agoI love Elm and I recommend it to everyone who wants to get into functional programming, especially Haskell. Additionally I'm glad .19 finally came out. But 18 months was really long. I'm guessing this was a good release point to show some major benefits, and I'm assuming that past 18 months was spent on more stuff that will come out later which is not ready yet. The main change seems to be a smaller codebase. Which is great. This is done by dead code elimination and not including unused modules in addition of some incremental size reduction by record field renaming (replacing someReallyLong.name with s.n) . However some of the other concepts that supposedly was going to improve SPAs etc. are not released yet.
- lsjroberts 8y agoThe SPA improvements look to have been released as the new `Browser` package, there's some good stuff in the guides on it - https://guide.elm-lang.org/webapps/ https://guide.elm-lang.org/webapps/
- chosenbreed 8y ago> Additionally I'm glad .19 finally came out. But 18 months was really long. On the basis that nothing was actually broken 18 months is not that long. I think there are benefits to be derived from working with a language/platform/ecosystem that doesn't change every few weeks. Just think about how many changes Angular has had in that time...
- kylecordes 8y agoAlthough many people have seared-in memories about the transition from AngularJS 1.x to Angular 2.0, since 2.0 the improvements and Angular have a lot in common with today's Elm release. The same code still compiles, to smaller and faster output. The few breaking changes or deprecations happen slowly, with plenty of warning, and very little effort to keep up. Of course it's more dramatic to find and discuss stark differences between "competing" platforms, but the boring truth here is that Angular and Elm are on the same side of the "should we be careful and methodical about development and change?" question.
- 8y ago
- hellofunk 8y ago> If you have ever tried to use ADVANCED_OPTIMIZATIONS in Google Closure Compiler, you know that this is extremely difficult even when you write all the code yourself Perhaps, but it’s quite nice when you use languages that were built to support Google Closure from the beginning, like Clojurescript. Then it is painless and built into the build process automatically, and you get to benefit from all the other great advantages of advanced optimizations in Google Closure that this article does not mention, and which Elm still cannot support or offer an alternative for, like automatic loop unrolling and other notable performance improvements.
- rtfeldman 8y agoCLJS is awesome too! For what it's worth, Elm 0.19 likely also works with Closure Compiler in Advanced Mode - it did in a quick proof of concept I tried, but obviously that's something you want to be really confident in before suggesting people use it!
- hellofunk 8y agoDid Elm change how it uses strings as a fundamental part of certain language constructs? That would break the advanced optimizations. According to the github issues tracker as well as mailing list comments from last year, these were not likely going to change in the language and therefore advanced optimizations are very fragile and likely to break on code in subtle ways. Note that Elm has always appeared to work on the surface with advanced optimizations, but the bugs would creep in and show up eventually, and the official advice has always been not to use those optimizations.
- Skinney 8y agoJust glanced through the code for 0.19 (I originally wrote an issue about the advanced opts incompatabilities for 0.18) and the things which caused problems before are gone. That's not to say that there are not other issues, though.
- kylecordes 8y agoLeveraging what is already in Closure Compiler was (and is) such a brilliant maneuver by ClojureScript - over the last few years I've seen various current tools gradually gain optimizations that were already in the box with ClojureScript when I built some things with it "forever ago". The big surprise though, is how few other new library/framework/platform/languages/whatever have followed this path.
- hardwaresofton 8y agoThey forgot Mithril[0] in the size comparisons -- I haven't seen anything useful beat it in size/value ratio. [0]: https://mithril.js.org/ https://mithril.js.org/
- rtfeldman 8y agoThe comparison was of RealWorld apps - you should contribute a Mithril one so that comparison would be possible next time! Here's the link: https://github.com/gothinkster/realworld/blob/master/README.md https://github.com/gothinkster/realworld/blob/master/README.... Have fun!
- hardwaresofton 8y agoHey thanks for the pointer! I'd never heard of the realworld example apps repo
- brlewis 8y agoSomebody started one but needs help finishing: https://github.com/barryels/realworld-mithril/projects/1 https://github.com/barryels/realworld-mithril/projects/1
- pdamoc 8y agoOut of curiosity, I've downloaded the Mithril implementation of Conduit from https://realworld-mithril.netlify.com/ https://realworld-mithril.netlify.com/ I have minified and gzipped `main.js` and it end up around 26k.
- rtfeldman 8y agoIt's apparently not feature complete yet. https://github.com/barryels/realworld-mithril/projects/1 https://github.com/barryels/realworld-mithril/projects/1 It's safe to assume it will be bigger when it's done, but who knows how much?
- stesch 8y agoDoes Elm rely on node.js and npm? Or is it usable without it?
- Skinney 8y agoElm doesn't use node.js or npm.
- rkangel 8y agonpm is used as one delivery system to get the elm compiler, but you can install it in other ways and it doesn't rely on the npm ecosystem.
- rtfeldman 8y agoYou don't need either to use Elm. The only way Elm uses node is for `elm repl`, since that needs a way to evaluate the compiled JS on the command line. The only way Elm uses npm is for `npm install --global elm` - but that's just as a convenient way to get a cross-platform installer. All it does is download the `elm` executable and put it on your PATH!
- deleted 8y ago[deleted]
- roadbeats 8y agoI’m an happy Elm user; but I wonder if it’s a worth investment to start using Elm when we’re heading to a new ecosystem on top of WebAssembly. I use Go on backend, and would feel satisfied when Go and Webassembly works together fine.
- Skinney 8y agoWebAssembly is still far away from being any sort of default for web development yet (if only because IE11 doesn't support it). I also wouldn't be surprised if Elm compiled to wasm in the future.
- dorian-graph 8y agoIt's openly a desired/considered goal for Elm to compile to wasm.
- Skinney 8y agoI know, I'm one of the people looking into it.
- dorian-graph 8y agoOh, haha! Cool.
- vimslayer 8y agoMost compilers that target WebAssembly can also target asm.js, which is compatible with IE. AFAIK it's more about missing stuff like DOM access and GC that stands in the way.
- Skinney 8y ago> Most compilers that target WebAssembly can also target asm.js, which is compatible with IE. asm.js is different enough that it's just not about adding a seperate asmjs "compatibility" target. On the top of my head you don't have 64-bit ints or floats and I believe the way you call asm.js fns from/to JS is different from wasm. Adding asm.js support just for IE 11 wouldn't be worth the effort.
- bobbby 8y agoAny upgrade guide? My 0.18 elm project doesn't seem to work with the latest version and the links it tells you to go to don't exist. This is pretty much consistent with my elm experience, I've never found it professional enough to consider for a production application.
- Skinney 8y agoIt's in the release notes, as with every other open source project: https://github.com/elm/compiler/blob/master/upgrade-docs/0.19.md https://github.com/elm/compiler/blob/master/upgrade-docs/0.1...
- bobbby 8y agoThanks It explicitly says I'm not allowed to tell you that the auto upgrade doesn't work for me and there's no details on how to do it manually. Sigh I'll try again in a few months.. maybe.
- Skinney 8y ago> there's no details on how to do it manually. The document I linked too contains the language and std-lib changes between 0.18 and 0.19, for the rest you use new packages. If you don't want to upgrade that's fine, but you're literally staring at the information on what to do.
- z5h 8y agoWhat if you created elm.js and compiled your code, and fixed what doesn't work according to the changes (https://github.com/elm/compiler/blob/master/upgrade-docs/0.19.md#changes https://github.com/elm/compiler/blob/master/upgrade-docs/0.1...)?
- masklinn 8y ago> It explicitly says I'm not allowed to tell you that the auto upgrade doesn't work for me and there's no details on how to do it manually. Uh… what? All it says is that elm-upgrade exists but is an alpha, and issues should be reported to the elm-upgrade repository.
- danmg 8y agoSwitched to mutt like 18 years ago.
- wereHamster 8y ago> Note that the React library itself is 32kb. Just the library without any application code. The entire Elm RealWorld App is 29kb, so no amount of code splitting can make the React version smaller than the Elm version! That's plain wrong. Code splitting doesn't work only on package level, it goes all the way down to individual module exports (ie. constants or functions). So it really depends on how well React is structured, and how well the minifier can do static and dynamic analysis.
- aczerepinski 8y agoI've dabbeled in Elm and have some trivial single static pages in Elm on one of my sites. Is there a book or blog series anybody could recommend that's less about the language and more about the practical steps of building a full single page app in Elm? How does routing work, do you need JS to integrate with your API, how to configure the compilation/build/deploy step, etc?
- innocentoldguy 8y agoI liked the Elm-related courses at Pragmatic Studio: https://pragmaticstudio.com/courses/elm https://pragmaticstudio.com/courses/elm
- wheatBread 8y agoI updated the official guide (https://guide.elm-lang.org/ https://guide.elm-lang.org/) to try to do a better job at that. It covers "routing" and JS interop much more clearly I think. So I recommend starting there and then asking around in the community if you run into anything!
- SupremumLimit 8y agoI wrote up a list of Elm resources (including books) recently: https://korban.net/posts/elm/2018-07-31-learning-elm-2018-comprehensive-list-resources/ https://korban.net/posts/elm/2018-07-31-learning-elm-2018-co... There are quite a few books/courses/articles which examine various aspects of building an SPA.
- G4BB3R 8y agoI've used Elm/Elixir(Phoenix) in production and it's currently the best stack for web development IMHO
- dogweather 8y agoWhat about SEO? Are there problems with that?
- G4BB3R 8y agoAtm yes. But there is a trick. Backend can check the request if it is a crawler (google, twitter and other bots) and serve a custom page for SEO. And for normal requests serve the normal SPA
- protomikron 8y agoSince there are some Elm users in this thread, I'll ask here: What's currently the best way to integrate an interactive map (i.e. zoom, pan, draw polygons, etc.) into an Elm application (something like leafletjs)? If I search for it, I find https://package.elm-lang.org/packages/kennib/elm-maps/latest https://package.elm-lang.org/packages/kennib/elm-maps/latest but the examples are not working for me, it feels like some mouse events get missed? E.g. here: https://kennib.github.io/elm-maps/examples/Fullscreen https://kennib.github.io/elm-maps/examples/Fullscreen [edit] Ok, it's not working for me on Firefox, but does seem to work better on Chromium (although some tiles are not rendered, but that might also be a server-side issue). Map support is crucial for me and was the reason I didn't dive into Elm so far, but maybe the problem is resolved now?
- rtfeldman 8y agoCustom Elements! Check out this talk about how to do it: https://www.youtube.com/watch?v=tyFe9Pw6TVE https://www.youtube.com/watch?v=tyFe9Pw6TVE For future reference, the quickest way to get questions like this answered is in the #beginners channel on Elm Slack: http://elmlang.herokuapp.com http://elmlang.herokuapp.com Tons of super helpful people there!
- protomikron 8y agoThank you for the quick response. Just out of interest are the examples working for you? E.g. Leaflet's Hello World is just ridiculously simple and short (if you check out the source): https://leafletjs.com/examples/quick-start/example.html https://leafletjs.com/examples/quick-start/example.html I am searching for something similar in Elm. I'll head over to other channels for more questions, thanks.
- rtfeldman 8y agoI honestly have never used LeafletJS, so I'd be the wrong person to ask - I'm just familiar with the technique to embed things like that in Elm applications. :)
- dhruvio 8y agoCongrats to the core team! I'm super happy to see 0.19. We recently went live with a website that was fully written in Elm 0.18 (www.project6.com). I'm excited to upgrade to 0.19 and take advantage of the new browser package. If anyone is interested in learning more about the decision-making process behind choosing Elm for that project, I discussed it during an Elm Town podcast episode (https://elmtown.audio/the-risk-of-elm-dhruv-dang https://elmtown.audio/the-risk-of-elm-dhruv-dang).
- tonyhb 8y agoThis sounds really cool, and it's exciting to see Elm come along! I always feel like Bucklescript and the Ocaml ecosystem doesn't get enough love when Elm crops up. Bucklescript has been doing aggressive dead code elimination for some time, and comes with the full type system of ocaml — plus easy JS interop: https://github.com/BuckleScript/bucklescript/wiki/Why-bucklescript-matters-for-Javascript-platform https://github.com/BuckleScript/bucklescript/wiki/Why-buckle.... As Elm develops I'm finding it harder and harder to choose between bucklescript/ocaml/reason and Elm. It's awesome to have all of these modern tools to work with on the frontend.
- hazza1 8y agoI've found the opposite, all the momentum seems to be with Reason - I don't hear of many new people picking up Elm. A release with smaller bundle is an amazing technical achievement but doesn't really address the underlying language and ecosystem issues.
- tonyhb 8y agoThat's reaffirming to hear. I love reason! Work has been BUSY and unfortunately haven't been able to keep up with the changes. Thanks for the heads up :)
- rtfeldman 8y ago> I don't hear of many new people picking up Elm. We sure do in the Elm community! I suspect this has more to do with who you follow than anything else. :) For example, if you follow a lot of React folks, you're naturally going to hear a lot more about Reason, because there's a lot of overlap in the people who work on those projects. Come check out our #beginners channel on Elm Slack sometime! It's constantly buzzing with activity: http://elmlang.herokuapp.com/ http://elmlang.herokuapp.com/
- hazza1 8y agoTrue, probably a lot of bias in my environment but I interview a lot of people for frontend roles - a couple of years ago Elm was the next exciting language to learn, it's now more often than not Reason.
- deltron3030 8y agoOne of the benefits of React and its components is that components built with design and prototyping tools (e.g. Figma) translate well to it. You design prototypes, test them, and translate the design components into react components. Elm seems more like a prototyping language itself, where you create your architecture as you go, easy to refactor (and thus live test I guess). Those of you who made the jump from React to Elm, did your approach to prototyping and evaluating what to build change? Do you prototype less before you jump into code?
- deleted 8y ago[deleted]
- korkota 8y agoawesome! what's next? > [_] Server-side rendering > [x] Tree shaking > [_] Code splitting > [_] Lazy loading https://github.com/elm/projects/blob/master/roadmap.md#how-do-i-make-a-single-page-app https://github.com/elm/projects/blob/master/roadmap.md#how-d...
- mchahn 8y agoI love the message, but the messenger is a bit over-the-top (infomercialish). >Just the opposite! The new compiler is quite fast!