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
1
vote
2 answers

Elm: String.toFloat doesn't work with comma only with point - what to do?

I'm very new to elm and i want to do a simple mileage counter app. If i get "1.2" (POINT) form input - String.toFloat returns in the OK branch with 1.2 as a number. But if i get "1,2" (COMMA) form input, then String.toFloat returns in the Err branch…
AIon
  • 12,521
  • 10
  • 47
  • 73
1
vote
1 answer

I cannot find module "Widget"

I have been following the Elm tutorial on the website and I tried it on a Mac and it worked, but when I ported it to Linux, it gave me the following error: - I cannot find module 'Widget'. Module 'Main' is trying to import it. Potential problems…
DevNebulae
  • 4,566
  • 3
  • 16
  • 27
1
vote
1 answer

How to implement debounced autosave in Elm lang 0.17?

I have the following scenario: when a user stops typing in the text area, I want to wait for 2 seconds and if the user didn't change anything in the textarea within those 2 seconds, I want to save the content of the textarea to the server. If the…
ondrej
  • 967
  • 7
  • 26
1
vote
1 answer

How to create a layer keybinding to execute a shell command in Spacemacs

I want to add a keybinding in dotspacemacs/user-config, to execute and external "elm-format" command, in the elm-layer, with some parameters: elm-format --yes current-file.elm I couldn't find how to do it, what I found on how to define keybindings…
JeanK
  • 1,765
  • 1
  • 15
  • 22
1
vote
2 answers

Reorder function arguments in Elm

I'm looking for a function of type (a -> b -> c -> d) -> c -> a -> b -> d. In other words, a function which can partially apply the third argument to a function. Is there a library that has such a function? Would it be useful for me to make one or…
dta
  • 654
  • 4
  • 19
1
vote
1 answer

Elm how to update head of list

I am trying to program small time tracking application, where I write what I do, and it just logs it. I successfully implemented adding entries to log, but now, I want to update last log entry with duration (for example when I started programming at…
Bunyk
  • 7,635
  • 8
  • 47
  • 79
1
vote
1 answer

Elm Type Svg.Svg has too few arguments

I am playing with Elm time example and trying to add more hands. To do it I extract code for hand like this: view : Model -> Html Msg view model = let angle = turns (Time.inMinutes model.time) in svg [ viewBox "0 0 100 100", width…
Bunyk
  • 7,635
  • 8
  • 47
  • 79
1
vote
1 answer

In a select element, how do I designate the initially selected option from my model in Elm?

Let's say I have a select element to choose a person, and I want to have a certain person, say with id = 3, to be initially selected. How do I pass this id down into my options, and then set the selected attribute to True in that options? Some…
Gabe
  • 1,166
  • 1
  • 12
  • 15
1
vote
1 answer

Rationale for order of arguments to `get` function

Why are the arguments ordered the way they are in Array.get and Dict.get? The order in most map/filter functions makes sense: the function comes before the collection (or monad, more generally). MyCollection.map : (a -> b) -> MyCollection a ->…
Eric
  • 1,511
  • 1
  • 15
  • 28
1
vote
1 answer

Elm Maybe.withDefault

I need to unwrap a Maybe -value in one of my update functions: update msg model = case msg of UpdateMainContent val -> Maybe.withDefault 100 (Just 42) model This of course is dummy code and the Maybe.withDefault 100 (Just…
swelet
  • 8,192
  • 5
  • 33
  • 45
1
vote
2 answers

Get offsetLeft on mousemove

In js, when handling event with addEventListener('mousemove',handler), inside the handler, we get access to the this which holds reference to the dom element, which has important properties like offsetLeft. How do I decode the this object in elm so…
Daniel Birowsky Popeski
  • 8,752
  • 12
  • 60
  • 125
1
vote
1 answer

Does Elm's lambda syntax support destructuring?

Can I write \(a, b) -> ... and expect a tuple parameter to be destructured?
jz87
  • 9,199
  • 10
  • 37
  • 42
1
vote
0 answers

Not always receiving json messages from elm-make with --report-json flag

I am trying to use the --report=json feature of elm-make to receive parseable error messages about the source files. Though it seems that elm-make doesn't always report errors in json, even with the proper flag. I experimented with using elm-make…
lookyhooky
  • 222
  • 1
  • 6
1
vote
2 answers

how to implement loading image when any http request occure

I have implemented the HTTP service request using elm architecture.but i am also want to implement any loading gif image so that user will know that something is happen in the back ground. can any please help me to implement to this implementation.
Manu Chawla
  • 327
  • 1
  • 12
1
vote
1 answer

Type conflict when generating a random list of integers in Elm

This is related to the Elm Tutorials (http://guide.elm-lang.org/architecture/effects/random.html), and am trying to generate a list of random numbers (just 2 items for now) for one of the challenges. I get a type error when trying to generate the…