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
13
votes
3 answers

What is a good way to internationalize an Elm application?

I need to internationalize the UI strings in my ELM HTML application to 3 different languages. I am thinking of doing this: 1) I will get the currentLanguage from Javascript, and pass it down in the ProgramWithFlags. I'llkeep the language in the…
jm.
  • 23,422
  • 22
  • 79
  • 93
13
votes
1 answer

how to chain Cmd Msgs

I have a list of Cmd Msgs that need to be run in order. I'm currently using Cmd.batch list but it seems like all of them are running simultaneously such that commands that should run later are unaware of any changes to the model the earlier commands…
erp
  • 515
  • 1
  • 5
  • 14
13
votes
1 answer

How can I get the error message out of Http.Error?

I'm attempting to complete an exercise in the Elm 0.17 tutorial for HTTP. If fetching a gif fails, I would like to let the user know why it failed with an error message. I've modified my model to be: type alias Model = { topic : String , gifUrl…
Martimatix
  • 1,553
  • 1
  • 15
  • 18
13
votes
3 answers

How to submit a form in Elm?

It's a really basic question but I didn't find any example. I have a view like this : view address model = div [] [ div [] [ text <|"ID : " ++ toString model.id ] , form [] [ input [ value model.title ] [] ,…
BoumTAC
  • 3,531
  • 6
  • 32
  • 44
13
votes
1 answer

What do the empty parentheses `()` mean in Elm?

I found out they are mean an empty tuple. However, are they also used as a convention by Elm programmers to mean "value can be ignored"? is13 : Int -> Result String () is13 code = if code == 13 then Ok () else Err "not the right key…
dgo.a
  • 2,634
  • 23
  • 35
13
votes
3 answers

Set the page title in elm?

How can I set the page title in elm, at program startup? I found this in the docs: (http://elm-lang.org/docs/syntax) Elm has some built-in port handlers that automatically take some imperative action: title sets the page title, ignoring empty…
Tom Kludy
  • 429
  • 3
  • 11
13
votes
1 answer

Why Debug.log prints out in reversed order in Elm?

Consider this program: import Graphics.Element exposing (..) import Debug main : Element main = let one = Debug.log "one" 1 two = Debug.log "two" 2 three = Debug.log "three" 3 in show "Hello" It prints out the following to…
Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746
13
votes
2 answers

Deploying as a standalone page

During the development process, I've been using elm-reactor to test my one-page Elm application. But for production deployment, I would like to just store the compiler's output as static files on a webserver. How do I compile an Elm page into a…
Cactus
  • 27,075
  • 9
  • 69
  • 149
12
votes
2 answers

How to get websockets working in Elm 0.19

I am trying to upgrade from version 0.18 to 0.19 of Elm. My project depends on elm-lang/websocket in 0.18? I cannot seem to find the equivalent package in 0.19. What am I missing?
John F. Miller
  • 26,961
  • 10
  • 71
  • 121
12
votes
2 answers

Using D3 with Elm

Is it manageable to using D3 with Elm using ports? I'm trying out Elm but I can't find any examples of using Elm with D3 without a wrapper API. The problem I've run into is that the wrapper and the forks don't work with 0.18. I'm also seeing a…
JimmyJames
  • 1,356
  • 1
  • 12
  • 24
12
votes
3 answers

Is there a way to use React Components within Elm?

I know that using Elm components ("modules"? still learning parlance) within React is an established pattern with libraries like react-elm-components, but is there a way to do the inverse? e.g., something like this is possible: Top-level React App …
Brandon
  • 7,736
  • 9
  • 47
  • 72
12
votes
1 answer

Is it possible to drive Elm app with existing navigation constructed outside of the Elm app?

I'm working with an existing Rails app where the navigation must continue to be constructed on the backend (due to complexity and time limitations). The intended result is to have some of the pages generated with Elm, and some with Rails, using no…
scoots
  • 715
  • 4
  • 16
12
votes
4 answers

How to auto-scroll to the bottom of a div in Elm

I add
s to a wrapper
and I need to be able to scroll to the last one added each time. How do I do this in Elm?
Anonymous: Hello
John:…
at.
  • 50,922
  • 104
  • 292
  • 461
12
votes
2 answers

Elm decoding unknown json structure

I've just started working with Elm to do some front-end prototyping using a Rest API I'm working on. In general, the API returns "reasonable" data structures that can be decoded because the keys and value-types are well-known, but several resource…
tjb1982
  • 2,257
  • 2
  • 26
  • 39
12
votes
2 answers

What does a function with 2 values on the right side mean? (Model -> Html msg)

I have encountered that in the guide: viewValidation : Model -> Html msg viewValidation model = let (color, message) = if model.password == model.passwordAgain then ("green", "OK") else ("red", "Passwords do not…
MoeSattler
  • 6,684
  • 6
  • 24
  • 44