Lisplog

Blogging in Lisp

Search

Feed Aggregator

Rendered on Wed, 19 Dec 2018 06:32:19 GMT  newer latest older 
Next udpate: Wed, 19 Dec 2018 07:00:00 GMT feeds

Why couldnt Elm (or an Elm like language) work on the back end

via Elm Discourse - Latest posts by @remmah on Wed, 19 Dec 2018 00:48:09 GMT

It looks like the SAFE stack folks (F#) are looking into the possibility of ‘server-side TEA’ with Elmish.Bridge. I haven’t used it myself so I’m not sure how well it works or how far along it is in development.

Setting focus on a select option

via Elm Discourse - Latest posts by @system system on Tue, 18 Dec 2018 22:13:10 GMT

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.

Visualizing module dependencies with Kite

via Elm Discourse - Latest posts by @Erkal_Selman Erkal Selman on Tue, 18 Dec 2018 21:58:42 GMT

The best that I could find online is dagre.
My hope is that in the future, people are going to implement graph drawing algorithms as elm packages and Kite is going to use them.

Visualizing module dependencies with Kite

via Elm Discourse - Latest posts by @dmy on Tue, 18 Dec 2018 18:30:32 GMT

Really nice video, and the UI looks fantastic.

Maybe there are some algorithm out there to optimize the nodes position by minimising crossings/overlaps between edges? I believe that graphviz uses something like that, but I may be wrong as I have not used it seriously since quite some time?

Visualizing module dependencies with Kite

via Elm Discourse - Latest posts by @Erkal_Selman Erkal Selman on Tue, 18 Dec 2018 17:55:15 GMT

Kite now helps you visualize the module dependency graph of your elm project.
Here is a video that illustrates how to do it.

Here are some improvements made after the last announcement:

  • undo/redo
  • elm-ui for the layout. There is no css any more.
  • multiple files with animated transitions between them. (This makes step-by-step visualizations of algorithms easy.)
  • using local storage for saving the graphs
  • an example for algorithm visualization (Dijsktra’s shortest path algorithm)
  • labels for nodes and edges
  • individual gravity centers for each node

You can see the roadmap for future plans.

Why couldnt Elm (or an Elm like language) work on the back end

via Elm Discourse - Latest posts by @rupert Rupert Smith on Tue, 18 Dec 2018 16:34:02 GMT

Genzero was a Java FIX (stock market trading) engine I wrote about 7 years back, which was equally as fast as C++ engines, faster in many cases. We did rather take things to extremes.

Here is a latency graph from testing:

The latencies on this concurrent connections benchmark are of the order of tens of milliseconds. Note the scale on my graph is in micro-seconds, and this was measured using a network tap so its the real network message in/out latency to the wire. This is 3 orders of magnitude faster than your typical web server, 100% in Java and relies heavily on mutability to avoid creating garbage. Of course, we are comparing different tests here, but I put it up just to show what some people are striving for on the server.

That said, your benchmark does show that in many cases immutability isn’t a bottleneck, I am pleasantly surprised by it. :+1: Certainly good enough for the web, just perhaps not for electronic trading or HPC.

Extreme efficiency can be important in HPC, because a factor of 10 speed up can mean you have 10x less servers to pay for. In many cases all the difference between a profitable operation and an unprofitable one.

Why couldnt Elm (or an Elm like language) work on the back end

via Elm Discourse - Latest posts by @robin.heggelund Robin Heggelund Hansen on Tue, 18 Dec 2018 15:39:14 GMT

Erlang / Elixir is heavily used for low-latency and scalable web services (like whatsapp). Erlang doesn’t support mutability at the VM level.

A lot of backends today does not need a computational fast language, but a language which is good at concurrency. Functional languages tend to be great at concurrency. So there’s no reason Elm couldn’t contend in this space someday in the future.

Responsive Text Size in Elm-UI

via Elm Discourse - Latest posts by @stevensonmt Stevensonmt on Tue, 18 Dec 2018 14:44:09 GMT

Simple ellie to illustrate what I was getting at in my previous post:
https://ellie-app.com/4c8wsgwsN9Sa1

Please note the flags being passed into the init of the elm app:

    <script>
        var app = Elm.Main.init({ node: document.querySelector('main')
                                ,
        flags: {
            width: window.innerWidth,
            height: window.innerHeight
        }})
        // you can use ports and stuff here
      </script>

Why couldnt Elm (or an Elm like language) work on the back end

via Elm Discourse - Latest posts by @rtfeldman Richard Feldman on Tue, 18 Dec 2018 13:26:39 GMT

Here is a concurrent connections benchmark showing Elixir and Clojure (both based on immutable data structures) outperforming every garbage-collected mutable-arrays language in the benchmark. (Only C++ outperformed the immutable-collections languages, which is presumably less about data structure choice and more that C++ never has to pause for garbage collection.)

Assuming mutability of sequential collections were somehow a significant bottleneck in a server’s ability to do low-latency high throughput processing of many concurrent connections, the focus of any concern should be whether Java’s slow and clunky mutable arrays can hope to compete with the obvious superiority of Elixir and Clojure’s immutable collections. :stuck_out_tongue_winking_eye:

Just to be super clear about it: the real point here is that mutable arrays don’t make a difference in this domain. It’s all about how the servers and VMs are architected.

Why couldnt Elm (or an Elm like language) work on the back end

via Elm Discourse - Latest posts by @rupert Rupert Smith on Tue, 18 Dec 2018 13:05:08 GMT

I think the simplest and least general role that Elm can play on the back-end right now, is server side rendering with rehydration on the client. There is no official support so its a bit hacky, but its been shown it can be done.

This is a really attractive way to use Elm for me, because I was able to replace my CSS, SASS, handlebars templates and a mish-mash of javascript bits and pieces with just Elm.

Why couldnt Elm (or an Elm like language) work on the back end

via Elm Discourse - Latest posts by @rupert Rupert Smith on Tue, 18 Dec 2018 13:00:22 GMT

I was telling a Java programmer about Elm recently. A Java programmer who works on low-level Java code for HPC, He didn’t like that Elm was immutable giving the example of quick sort. Quick sort is only quick sort if you are actually using mutable arrays - you can write the algorithm on top of the immutable HAMT arrays we have in Elm, but its not really the same algorithm. I did explain to him that the performance of Elm is very good, good enough for its domain generally.

But its a fair point. Web servers written in Java can be extremely efficient with low-latency and high throughput and handling thousands of connections - in part because of mutable arrays. This feels like something that Elm on the back-end could never compete with.

I imagine that a back end Elm would focus more on higher level things, like writing business logic or web APIs. When I think of all the service logic I’ve written or seen in Java, I now think of how much better that could would be in Elm.

Code Organization

via Elm Discourse - Latest posts by @Erkal_Selman Erkal Selman on Tue, 18 Dec 2018 10:42:36 GMT

These three talks helped me a lot with code organization

in case you haven’t watched them already.

Responsive Text Size in Elm-UI

via Elm Discourse - Latest posts by @Warry Maxime on Tue, 18 Dec 2018 10:38:04 GMT

You can achieve this with only CSS: https://css-tricks.com/fun-viewport-units/

I made a Boulder Dash type of game in Elm!

via Elm Discourse - Latest posts by @system system on Tue, 18 Dec 2018 09:53:52 GMT

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.

Code Organization

via Elm Discourse - Latest posts by @mgold on Tue, 18 Dec 2018 07:03:39 GMT

I think you’re on the right track. Try (as a starting point, adapt as necessary):

  • Common.elm, defining Msg, Model, and other types that are used everywhere
  • Most of your other files import Common.Something
  • Main.elm imports from everything (and is imported by nothing) and contains the main value.

Bug in trig functions

via Elm Discourse - Latest posts by @system system on Tue, 18 Dec 2018 05:49:14 GMT

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.

 newer latest older