workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
It's a decoder which, when successful, gives you a dictionary mapping strings to lists of strings
2019-04-25T17:52:56.024600
Huong
elmlang
general
You can apply the common model, view, update pattern but without the view. Export a model with init, an update and msg type. In your update Cmd.map the request like so: `request |> Cmd.map GotSomethingMsg` and then handle the msg like so: `GotSomethingMsg subMsg -> { model | smth = Something.update subMsg model.smth }`, you get the point.
2019-04-25T17:56:29.024800
Dayna
elmlang
general
Hey folks, I am using `elm-ui` for my app. Can i know how to use the attribute `disabled` on my `Input.text` please
2019-04-25T18:35:55.026200
Mirtha
elmlang
general
Disabled is not directly supported by elm ui. Instead you use the disabled condition to (a) do any conditional styling, and (b) ignore the related message in update.
2019-04-25T19:10:16.028300
Dede
elmlang
general
Is there a way to load sample data from an external file during testing?
2019-04-25T22:42:37.028800
Rico
elmlang
general
Specifically, I'm testing json decoders, and I'd rather have sample data live in separate `.json` files than in `.elm` files
2019-04-25T22:43:06.028900
Rico
elmlang
general
More specifically, I'm writing a library to serve as a wrapper around an existing large and complicated api. I'd like to `wget` a bunch of different calls (maybe 50 or so), run all my decoders against them, and make sure they all decode properly.
2019-04-25T22:46:05.029100
Rico
elmlang
general
Is there a function in Elm to round a number to a specific number of decimal places? Something that has this functionality: `toFloat (round (x * 10^n)) / 10^n`
2019-04-25T23:09:57.031700
Jacquelyn
elmlang
general
The problem is that Javascript’s (and Elm’s) number representation is not arbitrary precision. So you have things like `0.1+0.2=0.3000000000000000444089209850062616169452667236328125` So if you tried to round `0.1 + 0.2` you’d still end up with `0.3000000000000000444089209850062616169452667236328125`. If this is something you need for math calculations, I don’t know what the answer is. If it’s a display thing, I’d suggest a string formatting solution.
2019-04-25T23:22:15.031900
Leoma
elmlang
general
I found elm-round for that the other day and it worked great <https://package.elm-lang.org/packages/myrho/elm-round/latest/>
2019-04-25T23:31:32.032200
Augustus
elmlang
general
<@Leoma> this is for display purposes, is there a standard string formatting solution? <@Augustus> thanks
2019-04-26T01:16:17.033100
Jacquelyn
elmlang
general
<@Shona> seems plenty of companies use it in production. For heavy front-end stuff I wouldn't want to use anything else.
2019-04-26T01:46:22.034300
Erlene
elmlang
general
Lots of companies use it in production. Whether you should use it in production depends on what you're building. Elm has a small community so many things that exists 'out of the box' in React may not be available in Elm and you might need to be write them yourself
2019-04-26T01:49:26.034400
Earlean
elmlang
general
<@Augustus> that's the package I'm using. Works well.
2019-04-26T01:52:21.034600
Erlene
elmlang
general
This is the data structure of my Model.I want to change the data in "testCases". What should I do?
2019-04-26T02:04:03.034800
Carrie
elmlang
general
Write a function that will do the update to you want do to the value in the testCases field, pass that value to that function and update the root record `testCases` field with the result
2019-04-26T02:07:29.036600
Earlean
elmlang
general
eg. `{model | testCases = someFunctionToUpdateATestCase model.testCases}`
2019-04-26T02:08:19.037600
Earlean
elmlang
general
Oh, I see. Thank you very much.
2019-04-26T02:10:13.037900
Carrie
elmlang
general
I'm trying to build and run an Elm app (bootstrapped with create-elm-app) in a Docker container, but get a `CORRUPT BINARY` error. Anyone know what's up? I'll paste a bigger snippet of the error in this thread.
2019-04-26T04:11:40.040100
Bert
elmlang
general
``` Failed to compile. ./src/Main.elm Error: Compiler process exited with error Compilation failed [==================================================] - 1 / 1-- CORRUPT BINARY - /root/.elm/0.19.0/package/NoRedInk/elm-json-decode-pipeline/1.0.0/objs.dat The binary data at /root/.elm/0.19.0/package/NoRedInk/elm-json-decode-pipeline/1.0.0/objs.dat is corrupt. ```
2019-04-26T04:11:51.040200
Bert
elmlang
general
Is `/root` inside the container or is it on host machine?
2019-04-26T04:26:35.040400
Lynne
elmlang
general
in the container
2019-04-26T04:35:00.040600
Bert
elmlang
general
here's a snippet of the Dockerfile: ``` COPY package*.json ./ RUN npm ci COPY . ./ RUN npm run build ```
2019-04-26T04:35:49.040800
Bert
elmlang
general
the last line effectively just calls `elm-app build`
2019-04-26T04:36:25.041000
Bert
elmlang
general
May it be the missing permissions? Say elm could not download dependencies under `/root`?
2019-04-26T04:36:49.041200
Lynne
elmlang
general
I remember someone asked about something similar but I don't remember if there was a conclusion
2019-04-26T04:37:05.041400
Lynne
elmlang
general
just out of curiosity: are there any fancier json decode error processors than `errorToString`? I'm currently feeding the result of `errorToString` to an error port, which works well enough, but i'd really like to have some more fancy logging than a really long string
2019-04-26T04:45:35.043400
Emilee
elmlang
general
Offtopic, but, is that century schoolbook mono?
2019-04-26T04:48:21.044100
Bebe
elmlang
general
Or Linux libertine mono?
2019-04-26T04:49:25.044600
Bebe
elmlang
general
<@Emilee> `Json.Decode.Error` is an exposed type so you can deconstruct it yourself :slightly_smiling_face:
2019-04-26T04:52:10.045300
Nana
elmlang
general
``` type Error = Field String Error | Index Int Error | OneOf (List Error) | Failure String Value ```
2019-04-26T04:52:28.045600
Nana
elmlang
general
Wondering if I can get some assistance with SPA navigation - I'm routing around a simple SPA and I'm wanting to do some validation before routing to a different page. If the validation fails I don't want to route but I'm using `Browser.Application` and intercepting UrlRequests to route around
2019-04-26T05:54:05.046600
Catheryn
elmlang
general
can anyone help?
2019-04-26T05:54:48.047400
Catheryn
elmlang
general
<@Catheryn> sure, you can do that in your `update` when you handle the Msg for `onUrlRequest`
2019-04-26T06:00:50.048700
Earlean
elmlang
general
i know, i was just curious if anyone had already implemented some publicly available variants^^
2019-04-26T06:02:04.048800
Emilee
elmlang
general
Well it looks like nothing gets placed into `/root/.elm/`, but there are no EACCESS logs either
2019-04-26T06:22:47.049500
Bert
elmlang
general
``` update msg model = case msg of LinkClicked urlRequest -&gt; case urlRequest of Browser.Internal url -&gt; -- DO IT HERE? Debug.log "internal" ( model, Nav.pushUrl model.key (Url.toString url) ) Browser.External href -&gt; ( model, Nav.load href ) UrlChanged url -&gt; ( { model | url = url } , Cmd.none ) ``` <@Earlean> do it here?
2019-04-26T06:23:27.050300
Catheryn
elmlang
general
if I have mulitple pages where I want to perform different validations on, do I do it depending on what model.key is - does that make sense?
2019-04-26T06:24:18.051300
Catheryn
elmlang
general
You have access to the whole model, you can inspect the model and do whatever you want
2019-04-26T06:26:27.052300
Earlean
elmlang
general
thank you jessta
2019-04-26T06:56:14.052600
Catheryn
elmlang
general
Hi Elm friends. Has anyone worked on a version of `elm-sortable-table` for 0.19?
2019-04-26T09:39:01.053700
Royce
elmlang
general
I looked around but couldn’t find one.
2019-04-26T09:39:07.054000
Royce
elmlang
general
If you go to the Elm package site (<https://package.elm-lang.org>) and search sortable, several options come up.
2019-04-26T09:42:13.054700
Leoma
elmlang
general
Hahaha, guess I should have figured that would be better than random googling. :stuck_out_tongue: Thanks.
2019-04-26T09:43:27.055200
Royce
elmlang
general
I just started using <@Patricia> Skinney/keyboard-events, wich is a really nice addition to <@Bert> /keyboard . Emitting a a message when a key is press is really easy and elegant. However I do no see how to detect a modifier (like sight of CRTL) is pressed.
2019-04-26T09:46:05.057200
Allyn
elmlang
general
<https://github.com/billstclair/elm-sortable-table> is the new one
2019-04-26T09:58:01.057600
Sharon
elmlang
general
<https://package.elm-lang.org/packages/ohanhi/keyboard/latest/Keyboard#modifierKey>
2019-04-26T10:05:59.058800
Liza
elmlang
general
Did you read this part of the documentation?: `Keypress only triggers if the key produces a character. If you want to trigger a message when the spacebar is pressed, use Keydown instead.`
2019-04-26T10:06:40.059000
Patricia
elmlang
general
`spacebar` in this case refers to any modified key.
2019-04-26T10:06:53.059200
Patricia
elmlang
general
Should probably make the documentation a bit more clear on that.
2019-04-26T10:07:07.059400
Patricia
elmlang
general
So how do you detect, by example, CTRL+K?
2019-04-26T10:07:13.059600
Allyn
elmlang
general
And I used keydown indeed
2019-04-26T10:07:48.059900
Allyn
elmlang
general
Ah, sorry, I missunderstood.
2019-04-26T10:07:54.060100
Patricia
elmlang
general
In that case there's really no way around some book keeping. Keep a record around of which keys have been pressed, then do something when both CTRL and K have been pressed but not released.
2019-04-26T10:09:00.060300
Patricia
elmlang
general
Ok ; it’s not as easy than for keys without modifiers, but I get it
2019-04-26T10:10:12.060500
Allyn
elmlang
general
Thanks!
2019-04-26T10:10:15.060700
Allyn
elmlang
general
btw - you can just listen to “K” key down, and decode event, which contains mod current mod keys
2019-04-26T10:10:17.060900
Liza
elmlang
general
it means you directly use ohanhi/keyboard, doesn’t it?
2019-04-26T10:11:25.061100
Allyn
elmlang
general
kind of..
2019-04-26T10:11:46.061300
Liza
elmlang
general
or at least use different update function..
2019-04-26T10:12:02.061500
Liza
elmlang
general
<https://package.elm-lang.org/packages/ohanhi/keyboard/latest/Keyboard#updateWithParser> like
2019-04-26T10:12:32.061700
Liza
elmlang
general
i written my own subscription, for all that stuff, and if you go low level, then you can create own custom decoders, that can fail, and just ignore unneeded events (if onKey.. fails, it do it in silent way, and not produce additional lifecycle of TEA)
2019-04-26T10:16:15.061900
Liza
elmlang
general
Another update: I ended up wrapping my presign call with graphql, so I can easily generate my decoders &amp; send a request with only the file-name argument. :slightly_smiling_face: After that, it’s pretty easy, but I’m about 75% there.
2019-04-26T12:07:37.062500
Jeanene
elmlang
general
I want to write code to do some refactoring / editing, and was wondering what options exist for parsing Elm code to AST and back again. The first things that occurred to me were to look at the Elm compiler and `elm-format`, but I’m not sure whether I’m up for learning Haskell to do this (seems like it would take a while before I could make something useful), so I was wondering if there are other options? I saw `Bogdanp/elm-ast` (which has a bunch of forks), which was pretty exciting, but doesn’t work work with 0.19.
2019-04-26T15:40:45.070500
Johnsie
elmlang
general
I also saw that <@Ludie>’s project to do something similarish with atomist is no longer working, too: <https://github.com/satellite-of-love/elm-rugs>
2019-04-26T15:41:52.071300
Johnsie
elmlang
general
are you aware of elm-analyse? <https://github.com/stil4m/elm-analyse>
2019-04-26T15:43:32.071800
Virgie
elmlang
general
No, hadn’t seen that. Will take a look, thanks!
2019-04-26T15:43:57.072200
Johnsie
elmlang
general
<https://github.com/ellie-app/ellie/blob/master/assets/src/Effect/Program.elm#L202-L219> example of what <@Liza> describes
2019-04-26T15:54:42.072300
Huong
elmlang
general
Thanks! This led me to <https://github.com/stil4m/elm-syntax> which is what it seems to use for parsing Elm and writing it back. :slightly_smiling_face:
2019-04-26T15:59:16.072500
Johnsie
elmlang
general
Unfortunately, it seems to have some serious issues that would prevent me from being able to use it: <https://github.com/stil4m/elm-syntax/issues/30> and <https://github.com/stil4m/elm-syntax/issues/26> but it’s definitely something worth looking into more.
2019-04-26T16:04:57.072800
Johnsie
elmlang
general
how can I achieve a function with this signature `toDict : List (String, Maybe (List Int)) -&gt; Dict String (List Int)`
2019-04-26T16:43:14.074300
Vilma
elmlang
general
can’t figure out how to remove the `Maybe` from the list of integers
2019-04-26T16:43:32.074700
Vilma
elmlang
general
it seems like something must be done with `List.filterMap`
2019-04-26T16:48:58.075000
Vilma
elmlang
general
Well, you can filterMap with Maybe.map as an argument
2019-04-26T16:51:36.075900
Raylene
elmlang
general
not sure how that would work <@Raylene>
2019-04-26T16:55:00.077600
Vilma
elmlang
general
i would go for folding the list -&gt; <https://ellie-app.com/5nGvgKzCGf5a1>
2019-04-26T16:55:16.077800
Allison
elmlang
general
<@Allison> I see! that was obvious
2019-04-26T17:02:56.078300
Vilma
elmlang
general
thanks!
2019-04-26T17:02:57.078500
Vilma
elmlang
general
no problem, happy to help!
2019-04-26T17:05:13.078800
Allison
elmlang
general
Nice work. Thank you. I would like to see this example gain more popularity and trigger a discussion about SPA best practices.
2019-04-26T17:07:09.078900
Yoshiko
elmlang
general
Thanks for the kind words.
2019-04-26T17:14:59.079400
Dede
elmlang
general
Does anyone know if there will be recordings of Elm in the Spring at some point?
2019-04-26T17:37:09.080800
Jillian
elmlang
general
Yep. Keep on eye out sometime in May they should be up in the YouTubes.
2019-04-26T18:25:52.081600
Francis
elmlang
general
There is a libray for 0.18 version that supposed to handle two key events <https://package.elm-lang.org/packages/derrickreimer/elm-keys/1.1.0> I also have a project where I need to handle two keys at the same time. I haven't yet implemented it. But will pretty soon.
2019-04-26T18:58:20.081900
Lory
elmlang
general
Nice!
2019-04-26T19:41:42.082300
Jillian
elmlang
general
what's a good way of handling the 'browser reload' problem, where changing the URL means a browser reload will potentially fail if the URL isn't present on the backend service
2019-04-26T22:37:16.083700
Adrian
elmlang
general
I'm thinking either: backend service redirects/etc, or fragment navigation from the spa root
2019-04-26T22:37:41.084300
Adrian
elmlang
general
it seems ugly to have to deal with that on the backend at all, to be honest, but also seems wrong to have URLs that aren't *really* URLs
2019-04-26T22:38:38.085100
Adrian
elmlang
general
That’s *the* way to do it
2019-04-26T22:41:04.085600
Kris
elmlang
general
Route `/a/b` will look for a file in that path by default
2019-04-26T22:41:30.086400
Kris
elmlang
general
You need a server to route that. The standard way is to send everything, `/*` or whatever to your index.html
2019-04-26T22:42:11.087600
Kris
elmlang
general
Or yeah, use fake urls.
2019-04-26T22:42:20.087900
Kris
elmlang
general
thanks :slightly_smiling_face:
2019-04-26T22:50:20.088400
Adrian
elmlang
general
woops, wrong channel, apologies
2019-04-27T06:49:26.090700
Willene
elmlang
general
The solution pointed by <@Huong> is great. I implemented my own version strongly inspired by this one, and it works perfectly. Isn’t there any package implementing it (it does not look like) or documentation to help people find it?
2019-04-27T09:38:59.091200
Allyn
elmlang
general
Not that I’m aware of, but I haven’t actually checked :sweat_smile:
2019-04-27T09:39:39.091400
Huong
elmlang
general
Any channel we could follow now?
2019-04-27T10:55:00.092000
Bebe
elmlang
general
Is abyone else having troublr installing elm-svg?
2019-04-27T18:28:45.094000
Isaias
elmlang
general
The package is now called elm/svg
2019-04-27T18:29:15.094300
Wenona
elmlang
general
Oh right
2019-04-27T18:29:45.094900
Isaias