workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
Ok. Not supported. What could be the work-around?
2019-05-14T06:46:06.491100
Majorie
elmlang
general
Use Http.get, <http://Http.post|Http.post>, or Http.request
2019-05-14T06:47:16.491900
Danika
elmlang
general
ok. Thank you pd-andy :slightly_smiling_face:
2019-05-14T06:47:44.492500
Majorie
elmlang
general
As always, the docs will help (: <https://package.elm-lang.org/packages/elm/http/latest/>
2019-05-14T06:48:07.493000
Danika
elmlang
general
I wasnt around for 0.18 so I can’t really comment on how different the API is. The 0.18 docs have: ``` getWarAndPeace : Cmd Msg getWarAndPeace = Http.send NewBook &lt;| Http.getString "<https://example.com/books/war-and-peace.md>” ``` Which I guess would translate to: ``` getWarAndPeace : Cmd Msg getWarAndPea...
2019-05-14T06:51:32.495500
Danika
elmlang
general
This works: sendGet : (Result Error a -&gt; msg) -&gt; String -&gt; Decoder a -&gt; Cmd Msg -- oli Cmd msg sendGet msg theUrl theDecoder = -- Http.get theUrl theDecoder -- |&gt; Http.send msg Http.get { url = theUrl , expect = Http.expectJson LoadRepos ( Decode.list repoDecoder ) ...
2019-05-14T08:03:54.496000
Majorie
elmlang
general
When type Msg = UpdateQuery String | Search | LoadRepos (Result Http.Error (List Repo))
2019-05-14T08:04:29.496300
Majorie
elmlang
general
Can I ask a question about a weird error? I get a DOM error when compiling with "make" but it works when compiling with "make debug"
2019-05-14T08:53:04.497300
Kristina
elmlang
general
What is the error
2019-05-14T09:00:57.497600
Danika
elmlang
general
can it ever happen, that in `Date.now |&gt; Task.map (Debug.log "date") |&gt; Task.perform` the log is not triggered? I'd assume: no, but I have a case where it's like this.
2019-05-14T09:11:28.498900
Earnestine
elmlang
general
I have this code in the update function
2019-05-14T09:17:30.499000
Kristina
elmlang
general
The idea is that OpenNewLedgerModal creates a modal dialog. Then I want to select text in the dialog.
2019-05-14T09:18:35.000100
Kristina
elmlang
general
In order to have the dialog actually exist, there's a command sending a SelectName message.
2019-05-14T09:19:16.000800
Kristina
elmlang
general
That update command sends a command through a port to select the text, the element of which should now exist because Elm should hav had time to update the DOM.
2019-05-14T09:20:18.001900
Kristina
elmlang
general
If I compile with "make debug" this works fine. If I compile with "make" the element does not exist.
2019-05-14T09:20:49.002500
Kristina
elmlang
general
This is the code in the view function:
2019-05-14T09:23:49.002900
Kristina
elmlang
general
"openNewLedgerModal" is the function that creates the dialog.
2019-05-14T09:24:14.003500
Kristina
elmlang
general
<@Kristina> you need to wait for the next animation frame in JS and look for the element after that.
2019-05-14T09:39:36.004700
Earlean
elmlang
general
This is the javascript snippet that does the actual selecting:
2019-05-14T09:39:39.004800
Kristina
elmlang
general
Ah OK.
2019-05-14T09:39:52.005200
Kristina
elmlang
general
Do you know if I still need to create a new command message for the DOM to update, or is that unnecessary?
2019-05-14T09:41:16.005400
Kristina
elmlang
general
It's unnecessary
2019-05-14T09:44:42.005600
Earlean
elmlang
general
:thinking_face:
2019-05-14T09:48:09.005800
Nana
elmlang
general
try this: `Date.now |&gt; Task.map (\a -&gt; Debug.log "date" a) |&gt; Task.perform`
2019-05-14T09:49:05.006000
Nana
elmlang
general
OK, thank you for your help.
2019-05-14T09:50:50.006200
Kristina
elmlang
general
Why should this make a difference?
2019-05-14T09:51:06.006400
Millie
elmlang
general
yeah nvm
2019-05-14T09:56:01.006600
Nana
elmlang
general
Are you giving `Task.perform` a `(Date -&gt; msg)` argument? Are you getting the result as a msg anywhere?
2019-05-14T10:24:16.006800
Rico
elmlang
general
<https://github.com/elm-explorations/test>
2019-05-14T12:41:18.007200
Willodean
elmlang
general
I think these docs are out of date
2019-05-14T12:41:22.007400
Willodean
elmlang
general
A new meetup is born! Any Santa Barbarians out there? :grin: <https://twitter.com/dillontkearns/status/1128349527700717568>
2019-05-14T13:24:19.007900
Sade
elmlang
general
Actually is anyone able to get elm-test working on nixos?
2019-05-14T13:53:03.008400
Willodean
elmlang
general
<@Willodean> I did get it working at some point, but I forget the exact sequence of actions. I remember installing with npm and then going to edit some file, or move the executable someplace else. memory is hazy.
2019-05-14T14:12:05.009500
Lindsey
elmlang
general
there is mention of all this in the nixos bug tracker though
2019-05-14T14:12:24.010000
Lindsey
elmlang
general
<@Lindsey> where? Also I think I just need to supply `binwrap-install` to `elm-test`
2019-05-14T14:15:06.010600
Willodean
elmlang
general
but its not proving easy
2019-05-14T14:15:09.010800
Willodean
elmlang
general
<@Willodean> sorry I can't be more specific right now, I have to run. The upshot is that `which elm-test` gives me `/home/bburdette/.npm-packages/bin/elm-test`
2019-05-14T14:29:23.011700
Lindsey
elmlang
general
oh
2019-05-14T14:29:41.011900
Willodean
elmlang
general
that's not going to work for me
2019-05-14T14:29:46.012100
Willodean
elmlang
general
I need to run tests in the check phase of my build
2019-05-14T14:29:55.012400
Willodean
elmlang
general
K, well here's the nixpkgs issue: <https://github.com/NixOS/nixpkgs/issues/45280>
2019-05-14T14:32:52.013200
Lindsey
elmlang
general
I gave your API a try then. I have a data structure that represents the wires and chips on a circuit board (for a game I'm making). Currently I've written encoders and decoders for converting this to bytes and back. It involves a lot of record types and writing those using your API was quite easy to do. I didn't feel...
2019-05-14T16:05:09.013400
Jae
elmlang
general
Here's all the codecs I wrote if you're curious (took about 45 minutes to do)
2019-05-14T16:08:01.013800
Jae
elmlang
general
I hope this is a dumb question with a simple answer, but how do I turn a `List Json.Encode.Value` into a `Json.Encode.Value`? In 0.18.0, there was `Json.Encode.list`, but the purpose of that function was inexplicably (again, I can't find any documentation of this change in the changelogs/guides) changed.
2019-05-14T16:11:34.016500
Lu
elmlang
general
there is <https://package.elm-lang.org/packages/elm/json/latest/Json-Encode#list> which is now more flexible
2019-05-14T16:13:18.016800
Virgie
elmlang
general
because you supply the `a -&gt; Value` function, but if you already have a `Value`, use `identity` as that function
2019-05-14T16:13:45.017500
Virgie
elmlang
general
`identity : Value -&gt; Value`
2019-05-14T16:14:05.018000
Virgie
elmlang
general
No, I have a `List Value`, which is what `Json.Encode.list` use to accept
2019-05-14T16:14:26.018300
Lu
elmlang
general
yes, so `a ~ Value` in your case
2019-05-14T16:14:48.018900
Virgie
elmlang
general
no, `a` is a `List Value`. Maybe I'm missing something obvious
2019-05-14T16:15:33.019500
Lu
elmlang
general
oh....
2019-05-14T16:15:56.019700
Lu
elmlang
general
I see
2019-05-14T16:15:58.019900
Lu
elmlang
general
thank you
2019-05-14T16:16:00.020100
Lu
elmlang
general
The big advantage of the new API is that you don't have to manually map each item in the list: ``` -- 0.18 [1, 2, 3] |&gt; List.map <http://Encode.int|Encode.int> |&gt; Encode.list -- 0.19 [1, 2, 3] |&gt; Encode.list <http://Encode.int|Encode.int> ```
2019-05-14T16:17:53.021900
Carman
elmlang
general
<@Carman> for sure. that would have been nice when I originally wrote this code, but right now I'm trying to just get back to a stable compiling state
2019-05-14T16:19:43.023500
Lu
elmlang
general
Then as mentioned by <@Virgie>, `Encode.list identity` behaves like the 0.18 version of the function
2019-05-14T16:23:52.024900
Carman
elmlang
general
if you're trying to fix a lot of these it may be helpful to create a shim like: ``` oldListEncode : List Value -&gt; Value oldListEncode values = Encode.list identity values ```
2019-05-14T16:24:42.025900
Carman
elmlang
general
good idea, thanks <@Carman> and <@Virgie>
2019-05-14T16:25:56.026400
Lu
elmlang
general
Is there a good pattern for encoding a list where you may want to drop items? My current solution has to loop twice ``` Json.Encode.list identity &lt;| List.filterMap encodeIfInteresting things ```
2019-05-14T18:27:48.029400
Lu
elmlang
general
In my mind it doesn’t seem like it should be the decoders job to drop items
2019-05-14T19:10:02.030900
Danika
elmlang
general
makes sense, thanks
2019-05-14T19:28:01.031100
Lu
elmlang
general
Can someone share a discount code for Elm in Action?
2019-05-15T02:32:30.032500
Lory
elmlang
general
That would be great. P.S. I've got the coupon.
2019-05-15T02:32:36.032700
Lory
elmlang
general
index.html: &lt;script&gt; var app = Elm.Main.init({ node: document.querySelector('main') }) &lt;/script&gt; Main.elm the functionality. If I compile: elm make Main.elm -&gt; large index.html overwrites existing one How I should compile that var app is shown on html page?
2019-05-15T02:40:35.033000
Majorie
elmlang
general
If you are modifying your index.html, you shouldn't compile the html file but just the javascript file `elm make Main.elm --output=/dist/index.js` for example
2019-05-15T02:48:11.033500
Dexter
elmlang
general
(And then include dist/index.js in your html file)
2019-05-15T02:48:39.033700
Dexter
elmlang
general
OK. I have done that before. But I am wondering what is the idea having such (working in Ellie) line in index.html : var app = Elm.Main.init({ node: document.querySelector('main') })
2019-05-15T02:50:44.033900
Majorie
elmlang
general
because you might want to add Javascript that uses the ports you define (they will be available on `app.ports`)
2019-05-15T02:54:13.034100
Dexter
elmlang
general
I think var app = Elm.Main.init({ node: document.querySelector('main') }) should some how pick up the functionality from Main.elm
2019-05-15T02:57:39.034300
Majorie
elmlang
general
I should figure out how it should be compiled ..
2019-05-15T03:05:01.034500
Majorie
elmlang
general
It seems like you are still concerned with something <@Majorie>, is it correct?
2019-05-15T04:06:39.034700
Lynne
elmlang
general
Hi folks ! I would like to clearly identify when NOT using Elm. Could you give some concrete use cases where Elm was not suited (because of performance, ecosystem, ... whatever)? (please answer in the thread)
2019-05-15T04:15:17.037700
Loralee
elmlang
general
Well, this is working: &lt;script src="main.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="elm"&gt;&lt;/div&gt; &lt;main&gt;&lt;/main&gt; &lt;script&gt; //var app = Elm.Main.init({ node: document.querySelector('src/main') }) var app = Elm.Main.init({ node: document.getElementById...
2019-05-15T04:16:48.037800
Majorie
elmlang
general
So at the moment I leave "document.querySelector .."
2019-05-15T04:17:38.038100
Majorie
elmlang
general
`querySelector` is looking for nodes inside document so using it like this would not work, of course.
2019-05-15T04:42:38.038400
Lynne
elmlang
general
If you have further questions or don’t understand how anything works feel free to ask
2019-05-15T04:42:51.038600
Lynne
elmlang
general
Ok Thank you Sergey and Elvin !
2019-05-15T04:56:38.038800
Majorie
elmlang
general
I would (professionally) not use it in cases where I don’t build an UI for the web. I’ve seen experiments to use Elm in backend systems or even postgres triggers (<@Jin> :P). Those are nice and interesting experiments, and I really want to use Elm as much as I can, but as those things are not the current design focus o...
2019-05-15T05:10:03.039000
Timika
elmlang
general
Yeah, indeed I meant "not using Elm for the front end". I'm also pretty convinced that there isn't good other place for Elm outside front end *currently*.
2019-05-15T05:24:14.039400
Loralee
elmlang
general
Is there a simpler way to implement a set of radio boxes in elm?
2019-05-15T05:45:39.039600
Carrie
elmlang
general
the only exception I'd make is server-side-rendering, which can be achieved by using JSDOM or headless chrome if need be, other than that it's too risky to use Elm in other environments than frontend uis
2019-05-15T05:46:54.039700
Denae
elmlang
general
Simpler than what?
2019-05-15T06:04:21.041500
Lynne
elmlang
general
I'd like to ask if there is a well-defined method for radio boxes.
2019-05-15T06:06:42.043100
Carrie
elmlang
general
Yes, list of `input` elements with `type` `"radio"`
2019-05-15T06:09:37.045100
Lynne
elmlang
general
But he doesn't have the corresponding radio function. Do I need to define it in msg?
2019-05-15T06:13:18.048400
Carrie
elmlang
general
Hello. I risk repeating an earlier question by <@Daryl> about pre-loading, but I think it moves the discussion on (as well as asking a question to him in particular). There seem to be a number of strategies that people have used for preloading images: 1) A port to a javascript preloader, e.g. 'Programming Elm' and <htt...
2019-05-15T06:15:44.049900
Guadalupe
elmlang
general
Sorry, I don’t understand what you mean
2019-05-15T06:17:32.050200
Lynne
elmlang
general
<@Guadalupe> here's one pretty simple method I came up with: <https://ellie-app.com/5xFtMbppw64a1> (if the goal is specifically to smoothly load images)
2019-05-15T06:21:10.051300
Nana
elmlang
general
That looks sweet - and no, not just for the kittens! ; thanks for sharing that
2019-05-15T06:26:18.052200
Guadalupe
elmlang
general
When I chose another radio, the clicked radio was still in its original state.
2019-05-15T06:32:13.052300
Carrie
elmlang
general
I see. You need to set `checked` attribute of the radio button to match the value in model
2019-05-15T06:42:44.052700
Lynne
elmlang
general
For example, if you have `selectedOption` field which you update when user clicks on a button, you should add `checked (value == model.selectedOption)` where `value` is something identifying this particular button
2019-05-15T06:44:16.052900
Lynne
elmlang
general
<https://ellie-app.com/5xWFVYnRQGxa1>
2019-05-15T06:47:14.053100
Lynne
elmlang
general
A buddy of mine, who wrote a fair amount of Elm before deciding he didnt like it, said something to the effect of “We just re-write the front end every 8 months anyway, so investing a lot in stability and maintainability of our front end isnt worth it”.
2019-05-15T06:48:02.053300
Ashton
elmlang
general
I thought that was an interesting perspective, even if I dont ultimately agree with it.
2019-05-15T06:50:00.053500
Ashton
elmlang
general
It seems weird they re write ALL their codebase indeed.... it is maybe rewritten but incrementaly , no?
2019-05-15T07:10:03.053700
Loralee
elmlang
general
Or is it à special "front end"?
2019-05-15T07:10:27.053900
Loralee
elmlang
general
Defiantly food for thought <@Ashton> :thinking_face:
2019-05-15T07:11:04.054100
Timika
elmlang
general
Thank you very much.
2019-05-15T07:30:07.054300
Carrie
elmlang
general
it's also a good idea to wrap your radio buttons into something like: `radioGroup: {options:List (a, String), onChange:a -&gt; msg} -&gt; Html msg`
2019-05-15T07:53:13.054700
Nana