Questions tagged [elm]

Elm is a functional programming language for writing web applications that can fully replace, or interoperate with, HTML/CSS/JavaScript.

Elm is a functional programming language that is interoperable with HTML/CSS/JavaScript. It is optimized for creating web UIs, supporting complex user input without using callbacks.

Key features

  • Static types with type inference, with the best compiler errors ever
  • No runtime exceptions
  • No null or undefined in the language
  • Enforces semver for all Elm packages (you must update version number if you make a breaking change)

Resources:

Elm Books

1885 questions
103
votes
5 answers

Difference in Elm between type and type alias?

In Elm, I can't figure out when type is the appropriate keyword vs. type alias. The documentation doesn't seem to have an explanation of this, nor can I find one in the release notes. Is this documented somewhere?
ehdv
  • 4,483
  • 7
  • 32
  • 47
100
votes
1 answer

Elm Compiler running forever, computer just getting hot

I'm not sure what's causing this issue, but in a project, I'm building, the compiler is taking hours just to compile a module. The total size of my codebase is 352KB, but none of the modules are over 10KB large. I am using a Native port, but it's…
Athan Clark
  • 3,886
  • 2
  • 21
  • 39
64
votes
6 answers

What does the `<<` operator mean in elm?

In the following code taken from Elm Form Example, line 122, what does the << operator mean? Field.field Field.defaultStyle (Signal.send updateChan << toUpdate) "" content Couldn't find it in Elm syntax reference. Does it mean, when the field…
Not an ID
  • 2,579
  • 2
  • 21
  • 28
57
votes
2 answers

What does "! []" Elm code syntax in Todomvc mean

Coming from react, I am learning to understand Elm. In the Todomvc example code, there is the following code snippet: -- How we update our Model on a given Msg? update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of NoOp…
wintvelt
  • 13,855
  • 3
  • 38
  • 43
52
votes
3 answers

What are the advantages and disadvantages of Angular.js vs. Elm?

I'm looking into doing some reactive programming in the browser and comparing angular.js (http://angularjs.org/) with Elm (http://elm-lang.org/). What are the relative benefits / problems with each?
interstar
  • 26,048
  • 36
  • 112
  • 180
47
votes
6 answers

How to set focus on an element in Elm?

How can I set the focus on a Html element in Elm? I tried to set the autofocus attribute on the element and it only sets the focus on the page load.
Martinos
  • 2,116
  • 1
  • 21
  • 28
46
votes
1 answer

How to create HTML data attributes in Elm?

I need to tag my Elm.Http elements with custom "data-*" attributes, for example: ... I have tried the following: import Html exposing (..) import Html.Attributes exposing (..) import Json.Encode as JsEncode view ... = tr […
wmakley
  • 1,233
  • 9
  • 18
44
votes
3 answers

Elm: How would you build and style your UI?

For the last few days I've learning about Elm, and it has been a refreshing experience. So much that I do not want to go back into JS land, :-(. My problem is that I still do not see a way to produce a web app with elm, and I would love some…
alesch
  • 842
  • 2
  • 8
  • 16
42
votes
3 answers

How does Elm compare to ClojureScript?

I'm reaching a point where GUI coding with Backbone.js object-oriented MVC pattern is getting quite complex, and looking around at other paradigms. MDV, FRP, ECS, oh my. How does Elm compare to ClojureScript? Where do they overlap? Both are…
forresto
  • 12,078
  • 7
  • 45
  • 64
34
votes
1 answer

ReasonML vs Elm

I saw this ReasonML vs TypeScript question here at StackOverflow, now I'm wondering how ReasonML and Elm compare to each other. What are their similarities and differences? Which one should I use when? What's the advantage of one over the other?
John Paul Ada
  • 537
  • 5
  • 9
32
votes
2 answers

Run two commands at the same time in Elm

In Elm, and specifically with the Elm Architecture when the app first starts the init function can return a Cmd Msg that is executed. We can use this for sending http requests or send a message to native Javascript via Elm ports. My question is, how…
antfx
  • 3,205
  • 3
  • 35
  • 45
31
votes
4 answers

How to achieve behavior of setTimeout in Elm

I'm writing a web game in Elm with lot of time-dependent events and I'm looking for a way to schedule an event at a specific time delay. In JavaScript I used setTimeout(f, timeout), which obviously worked very well, but - for various reasons - I…
Tomasz Lewowski
  • 1,935
  • 21
  • 29
31
votes
6 answers

How to handle Enter key press in input field?

I built a simple app for learning purposes and want to be able to dispatch an action when the user presses Enter key in input field view : Model -> Html Action view model = let items = List.map (\ item -> li [] [ text item ])…
SuperManEver
  • 2,263
  • 6
  • 28
  • 36
31
votes
1 answer

Cancel subscriptions in Elm

I am following the Elm guide and I am at the point where I try to implement a Pause button for the clock example. In the guide it is written: Add a button to pause the clock, turning the Time subscription off. All I did was add a paused attribute…
Pep.
  • 360
  • 4
  • 9
31
votes
3 answers

How do I get a list item by index in elm?

I got a list, and now I want the nth item. In Haskell I would use !!, but I can't find an elm variant of that.
11684
  • 7,356
  • 12
  • 48
  • 71
1
2 3
99 100