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

Turning a list of Integers into a List of Colors

I have an image stored as a very large List Int and I would like to turn them into a List Color However remember that rgb requires 3 arguments and rgba requires 4. So let's try: toColor : List Int -> List Color toColor x = if List.isEmpty x…
john mangual
  • 7,718
  • 13
  • 56
  • 95
1
vote
1 answer

ELM : error while embedding ( List of HTML ) in div second argument

Given a List of String , I want to create a List of HTML div in order to inject it in view : I wondered that the function signature should be as following : display : List String -> List Html div and the function body : display model = case…
khaled alomar
  • 673
  • 4
  • 25
1
vote
1 answer

How to convert Task Http.RawError Http.Response to Task String (Int, Int)

There are a type and a task type Msg = Fail String | Success (Int, Int) makeRequest = let req = { verb = "GET" , headers = [] , url = "http://localhost:8080" , body = empty } in Task.perform Fail…
ztsu
  • 25
  • 7
1
vote
1 answer

How to force evaluation of value in Debug.log

Using Elm 0.17, I'd sometimes like to see the steps taken during a computation, such as: let names = Debug.log "accounts" List.map (\x -> x.name) accounts sortedNames = Debug.log "sorted accounts" List.sortBy String.toLower…
François Beausoleil
  • 16,265
  • 11
  • 67
  • 90
1
vote
1 answer

Setting values in aliased records

I'm just starting out with Elm, so be nice:) In the "Random" example of the official Elm Guide the model seems to be initialized with the value 1 like this: type alias Model = { dieFace : Int } init : (Model, Cmd Msg) init = (Model 1,…
swelet
  • 8,192
  • 5
  • 33
  • 45
1
vote
2 answers

width of paragraph in Elm

Trying to make paragraph a certain width but the paragraph runs over. Why does Elm ignore me? That width must be an integer, so I gave it the width in pixels. import Html exposing (..) import Html.Attributes exposing (..) info : String info =…
john mangual
  • 7,718
  • 13
  • 56
  • 95
1
vote
1 answer

Uncaught ReferenceError: _elm_lang$virtual_dom$VirtualDom$text is not defined

I have a pretty small elm application that I have been working on. Things have been going okay, but now I getting a runtime error that I can't figure out. My elm app compiles just fine with elm make or even with elm reactor but when I load the page…
sambev
  • 131
  • 7
1
vote
1 answer

Elm: Iterate list performing multiple HTTP requests

I'm wondering if I can get some help with iterating a list of groups, making a POST request for each group to create a 'room', iterating the users for each group and making a POST request to assign them to this specific room. I have the following…
Denim Demon
  • 734
  • 1
  • 10
  • 23
1
vote
2 answers

How to decode JSON to record built by a data constructor?

There is the type type User = Anonymous | Named {name : String, email : String} Json.Decode.object2 doesn't fit here because its first arguments type is (a -> b -> c) but Named has { email : String, name : String } -> User type. How to decode…
ztsu
  • 25
  • 7
1
vote
3 answers

elm: how get just one line with the elm version?

How get just one line with the elm version ? For now I get this: $ elm-make --version elm-make 0.17 (Elm Platform 0.17.0) Usage: elm-make [FILES...] [--output FILE] [--yes] [--report FORMAT] [--warn] [--docs FILE] [--prepublish]…
user3313834
  • 7,327
  • 12
  • 56
  • 99
1
vote
1 answer

jQuery animate/scroll only partially works on second click

When I use jQuery to animate the scrolling behavior the first click will cause the view to jump straight to the clicked anchor element. The second click, if issued within the animation-delay, will work flawlessly. If the animation-delay runs out and…
Philipp Meissner
  • 5,273
  • 5
  • 34
  • 59
1
vote
1 answer

How can I preserve canvas content in Elm between updates

I have a question about Elm canvas. Is there a way to prevent the canvas to be erased/reinserted in the DOM on each frame? I am trying to dynamically generate an image by changing a particle system (Model) and then drawing it. The pseudocode looks…
Adrian
  • 1,006
  • 2
  • 9
  • 20
1
vote
2 answers

How can I randomly generate a pair of floats in Elm?

I am trying to create a Random.Generator (Float, Float) where the first Float is in some range say 0.0 1000.0 and the second between 0.0 and the first value. Example of valid values: (12.0, 5.0) Invalid: (303.0, 800.0) I looked over code in…
Adrian
  • 1,006
  • 2
  • 9
  • 20
1
vote
1 answer

Elm 0.17 Simple Mouse.clicks example

To get familiar with subscriptions in 0.17 I'm trying to get a simple app going that subscribes to Mouse.clicks and would increment the Model by one. At the moment the app has the following complaint. Function program is expecting the argument to…
Denim Demon
  • 734
  • 1
  • 10
  • 23
1
vote
1 answer

Elm 0.17 - JSON data not rendering in view

I'm new to Elm and trying to figure out 0.17. I'm wondering if anyone has insight to why my data isn't rendering in the view here. In the Chrome console I can see that the GET request is made successfully, but it never actually displays on the page.…
Ronu
  • 53
  • 5