workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
(need to think if this was a valid statement though)
2019-05-17T06:41:53.134700
Lynne
elmlang
general
if only `type ID = ID String` and such were `comparable` :pray:
2019-05-17T06:42:04.134900
Nana
elmlang
general
Yeah, that’s a good use-case :thumbsup:
2019-05-17T06:43:04.135100
Huong
elmlang
general
If I don’t forget, I’ll add it somewhere this weekend
2019-05-17T06:43:30.135300
Huong
elmlang
general
<@Lynne> I'm already short-circuiting on the first error, I think `Result.andThen` would just be another way of writing it instead of using `case..of` ?
2019-05-17T06:51:27.135500
Nana
elmlang
general
<@Huong> cool :smile: submitted an issue
2019-05-17T06:52:22.135800
Nana
elmlang
general
or actually I'm not short-circuiting, and neither would `Result.andThen`
2019-05-17T07:00:23.136100
Nana
elmlang
general
to do that you'd have to write a recursive function instead of using `List.foldr`
2019-05-17T07:00:58.136300
Nana
elmlang
general
oh btw `decodeString` doesn't work, unless you first wrap the string in `"`
2019-05-17T07:04:50.136500
Nana
elmlang
general
Correct, that’s what I was fighting with…
2019-05-17T07:06:18.136700
Lynne
elmlang
general
(json-extra uses the recursive approach. Pro: it short circuits. Con: it’s not currently tail-recursive, so probably best not to use it on objects with ~6k entries. I plan to take care of that this weekend, too)
2019-05-17T07:06:27.136900
Huong
elmlang
general
That’s what I have come with so far: <https://ellie-app.com/5yQzNPkJFYxa1>
2019-05-17T07:07:11.137100
Lynne
elmlang
general
(Safari sucks btw)
2019-05-17T07:07:26.137400
Lynne
elmlang
general
Dunno if it is better than what <@Nana> suggested
2019-05-17T07:07:54.137600
Lynne
elmlang
general
But as far as I understand it is tail recursive
2019-05-17T07:08:06.137800
Lynne
elmlang
general
yeah, need to reverse the list at the end, though. Technically JS object aren’t ordered, but there is a (fair) expectation that order is preserved nevertheless
2019-05-17T07:08:19.138000
Huong
elmlang
general
Correct
2019-05-17T07:08:30.138200
Lynne
elmlang
general
<https://ellie-app.com/5yQCyPfyFC4a1>
2019-05-17T07:09:12.138400
Lynne
elmlang
general
yep, exactly
2019-05-17T07:09:53.138600
Huong
elmlang
general
The hardest thing is finding a name :sweat_smile:
2019-05-17T07:10:10.138800
Huong
elmlang
general
Yeah…
2019-05-17T07:10:50.139000
Lynne
elmlang
general
since you have `dict2` which is the equivalent for `Decode.dict` I guess you could call it `keyValuePairs2` ?
2019-05-17T07:11:48.139200
Nana
elmlang
general
Yeah, that would be my first idea, too. It seems like pretty bad naming, though, but then I also don’t want to do a breaking change. Urgh, naming.
2019-05-17T07:13:08.139400
Huong
elmlang
general
Something like `typedKeyValuePairs` or `keyValuePairsTyped` maybe?
2019-05-17T07:16:20.139600
Lynne
elmlang
general
customKeyValuePairs?
2019-05-17T08:27:08.139900
Raylene
elmlang
general
<@Nana> forgive me, i just opened slack and i could only think about this: <https://imgur.com/a/JHKOHEn>
2019-05-17T10:21:50.141600
Lilli
elmlang
general
Does anyone know the depth of `lazy1`?
2019-05-17T13:00:38.143400
Willodean
elmlang
general
what is the map size?
2019-05-17T13:00:51.143700
Willodean
elmlang
general
<@Willodean> it doesn't really have a depth, it memoizes a function with one argument
2019-05-17T13:25:06.145000
Augustus
elmlang
general
The code bit for it is here <https://github.com/elm/virtual-dom/blob/dev/src/Elm/Kernel/VirtualDom.js#L685>
2019-05-17T13:25:59.145900
Augustus
elmlang
general
<@Augustus> by depth I mean what is the cache size?
2019-05-17T13:26:08.146100
Willodean
elmlang
general
It isn't stored in a cache like you are thinking of
2019-05-17T13:27:00.146900
Augustus
elmlang
general
Check out that code in virtual DOM, there is is comparing the old and new arguments to see if they are referentially equal, if they are all equal it will lazy render
2019-05-17T13:28:14.148200
Augustus
elmlang
general
so the depth is 1
2019-05-17T13:41:21.148900
Willodean
elmlang
general
as in it stores the last value only
2019-05-17T13:41:32.149200
Willodean
elmlang
general
The old arguements is the cache
2019-05-17T13:42:05.149600
Willodean
elmlang
general
Sorry I thought you were talking depth like keeping a cache for the arguments to view functions for child nodes of lazy nodes
2019-05-17T13:46:27.151300
Augustus
elmlang
general
right, which it does <@Augustus>
2019-05-17T14:26:36.151600
Willodean
elmlang
general
Thanks! I have been playing a bit with lazy and keyed and they didn't seem to make any difference. After poking a bit, it seems that it's specifically how the _menu_ plugin manipulates the DOM to insert the menu. I'll try web components first, and if not I'll probably modify the menu plugin to expect that the needed HT...
2019-05-17T14:34:41.152000
Kira
elmlang
general
nah it only does for the top level, if any of the arguments has changed it re-renders it all
2019-05-17T14:41:11.153300
Alicia
elmlang
general
forgot I switched accounts, antew is me too, this is my work account :slightly_smiling_face:
2019-05-17T14:41:31.153800
Alicia
elmlang
general
like say you have a function ``` renderSomething: Int -&gt; Int -&gt; Html msg renderSomething val1 val2 = div [] [ div [] [ text &lt;| String.fromInt val1 ] , div [] [ text &lt;| String.fromInt val2 ] ] ``` With some extra work it could be able to see that if only `val1` changes or only `val2` chan...
2019-05-17T14:43:24.155700
Alicia
elmlang
general
I keep forgetting this :sweat_smile:
2019-05-17T16:36:44.156000
Huong
elmlang
general
I need to just delete this one and go on antew only :cry:
2019-05-17T16:44:11.156200
Alicia
elmlang
general
Hi. I am trying to create a fuzzer of type Fuzzer (List Int) that would contain exactly 10 random integer values ranging from 0 to 10. Has anyone ever came up with something similar? Thanks.
2019-05-17T18:00:15.158400
Shin
elmlang
general
yea, you'd need this function ``` combine : List (Fuzzer a) -&gt; Fuzzer (List a) combine l = case l of [] -&gt; Fuzz.constant [] x :: xs -&gt; Fuzz.map2 (::) x (combine xs) ```
2019-05-17T18:16:20.158900
Virgie
elmlang
general
then I think `combine (List.repeat 10 (Fuzz.intRange 0 10))` should do it
2019-05-17T18:16:44.159400
Virgie
elmlang
general
Thanks <@Virgie> for the quick reply.
2019-05-17T18:18:37.159800
Shin
elmlang
general
a more efficient version (for general use, 10 element lists are fine) is ``` combine : List (Fuzzer a) -&gt; Fuzzer (List a) combine list = combineHelp list (Fuzz.constant []) combineHelp rest accum = case rest of [] -&gt; accum x :: xs -&gt; combineHelp rest (Fuzz.map2 ...
2019-05-17T18:19:15.160300
Virgie
elmlang
general
So... `traverse` :stuck_out_tongue_closed_eyes:
2019-05-17T19:00:36.160800
Raylene
elmlang
general
Hi, I'm new. Guide me
2019-05-17T19:22:10.161300
Isiah
elmlang
general
<@Isiah> <https://guide.elm-lang.org/>
2019-05-17T19:22:51.161500
Nana
elmlang
general
Thanks <@Nana>
2019-05-17T19:23:38.161900
Isiah
elmlang
general
Am I missing something or there isn’t a direct way to generate a `List` of values with a “step” parameter? Something like `List.range start end step` ? I guess I have to use range and then multiply the value, right? `0 1 2 3` * step
2019-05-18T05:56:01.164600
Hoa
elmlang
general
Doesn't look like there's a `List.range` with step, not even in `elm-community/List.Extra`
2019-05-18T06:06:00.164800
Jae
elmlang
general
Yeah, I checked there too.
2019-05-18T06:09:04.165100
Hoa
elmlang
general
Sounds like a chance to implement it and make a pull request
2019-05-18T06:09:58.165300
Jae
elmlang
general
is there a common way to embed videos from multiple sources (yt and vimeo)? I would like to use something like <https://plyr.io>
2019-05-18T06:13:21.166100
Allison
elmlang
general
You could wrap that in a web component
2019-05-18T06:13:44.166500
Danika
elmlang
general
:thinking_face: the plyr player?
2019-05-18T06:14:15.166900
Allison
elmlang
general
Yeah, just wrap it if it works for you
2019-05-18T06:25:45.167400
Raylene
elmlang
general
How it will work with elm’s runtime if the js code changes the component? What I mean is — I thought I cannot let js modify the DOM because it will break elm’s virtual DOM (similarly to how adblockers breaks elm code)..
2019-05-18T06:30:02.169600
Allison
elmlang
general
thats what web components are for, you create the web component in elm, and that components js handles its own "sub" dom
2019-05-18T06:31:30.170100
Danika
elmlang
general
awesome! haven’t heard of it before! every day you learn something new I guess.. thanks!
2019-05-18T06:33:11.170800
Allison
elmlang
general
Hi, how can I parse URL query parameters into a list of key value pairs? I’m able to parse them, if I know what they are, but not if they can be anything. E.g. I want to parse this URL: ```host:80/path?a=1&amp;b=2&amp;foo=bar``` into: ``` [("a", "1"), ("b", "2"), ("foo", "bar")] ```
2019-05-18T08:30:30.174100
Tarah
elmlang
general
One crude way would be to just take that string after `?` and split by `&amp;`. This way you are able to handle any number of params
2019-05-18T08:45:47.175400
Hoa
elmlang
general
It’s more fragile, of course
2019-05-18T08:46:03.175700
Hoa
elmlang
general
Ok, I'll do that, until I find a better way. Thx
2019-05-18T09:29:26.176400
Tarah
elmlang
general
You might be able to use <https://package.elm-lang.org/packages/elm/url/latest/Url-Parser-Query>
2019-05-18T10:48:07.176600
Su
elmlang
general
This is exactly what my problem is. I cannot come up with a way to achieve this with that API.
2019-05-18T10:57:21.176700
Tarah
elmlang
general
Sorry about that, I didn’t read your question carefully enough…I understand your problem now. This sounds like a task that is big, but you could write your own parser with <https://package.elm-lang.org/packages/elm/parser/latest/>. There is an elm-conf talk about parsers; it’s featured in the latest issue of elm weekly...
2019-05-18T11:56:03.177000
Su
elmlang
general
Hi, Was your talk recorded? Could I watch it?
2019-05-18T12:33:40.177300
Giselle
elmlang
general
Hi all, does anyone have an example of killing Process.sleep tasks before they resolve? I'm having a hard time making sense of the process module and what to do with it
2019-05-18T13:15:41.179000
Bebe
elmlang
general
Basically I want to cancel a timeout once something has happened to avoid undesired messages coming in
2019-05-18T13:16:12.179500
Bebe
elmlang
general
what do you have so far?
2019-05-18T13:18:06.180600
Virgie
elmlang
general
Do I have to Task.perform both the Process.sleep and the Process.spawn sleepTask and make a message to get the Id of the timeout?
2019-05-18T13:18:26.181100
Bebe
elmlang
general
not much, I've been trying to figure out what code to write to be honest :sweat_smile:
2019-05-18T13:18:59.181600
Bebe
elmlang
general
yea, I think you need to first perform the spawning (so you have an ID), store that in the model, then kill when needed
2019-05-18T13:20:25.182500
Virgie
elmlang
general
``` abandonTimeout : Msg -&gt; Cmd Msg abandonTimeout msg = let sleepTask = Process.sleep 300 timer = Process.spawn sleepTask in Cmd.batch [ Task.perform (\() -&gt; msg) sleepTask , Task.perform (\id -&gt; TimeoutId id) timer ] ``` this seems ...
2019-05-18T13:21:59.183400
Bebe
elmlang
general
I wonder if I'm spawning the sleep task twice with what I'm doing
2019-05-18T13:26:23.184900
Bebe
elmlang
general
:confused: so confused
2019-05-18T13:26:27.185100
Bebe
elmlang
general
I think you are
2019-05-18T13:26:32.185300
Virgie
elmlang
general
so what do you want this to do?
2019-05-18T13:26:42.185500
Virgie
elmlang
general
i want to get a `Msg` after 300 ms to do some logic. I want to cancel that Task if something else happens before the 300ms so that that `Msg` never arrives
2019-05-18T13:27:44.186700
Bebe
elmlang
general
sounds ridiculous, but I'm dealing with mouse enter and leave interactions which actually have that kind of timely interactions
2019-05-18T13:28:15.187400
Bebe
elmlang
general
gonna try on an ellie
2019-05-18T13:28:49.187800
Bebe
elmlang
general
that thing I wrote is definitely not working. I'm still getting the timeout message even if I kill the pid, so I must be killing the duplicate sleep task
2019-05-18T13:46:28.188600
Bebe
elmlang
general
here is the example: <https://ellie-app.com/5zqtzfQMRZxa1> clicking trigger timeout and cancelling it before two seconds, look at the logs (bottom up) and the TimedOut message is still received
2019-05-18T13:49:00.189300
Bebe
elmlang
general
I'm not sure what to do, seems like a simple enough use case, but I can't figure out Process, and I'm not having much luck with google
2019-05-18T13:58:53.190500
Bebe
elmlang
general
<https://ellie-app.com/5zqF55LKc92a1>
2019-05-18T14:00:02.190700
Lynne
elmlang
general
Seems like it works now
2019-05-18T14:00:12.191000
Lynne
elmlang
general
WOT
2019-05-18T14:01:30.191300
Bebe
elmlang
general
Apparently you created two processes
2019-05-18T14:02:14.191600
Lynne
elmlang
general
yeah, I had no idea what I was doing lol
2019-05-18T14:02:31.192200
Bebe
elmlang
general
One was killed (presumably), another one completed
2019-05-18T14:02:32.192400
Lynne
elmlang
general
I see now, you are using Task.succeed to trigger a message. That's the missing piece I wasn't thinking aoubt
2019-05-18T14:02:51.193400
Bebe
elmlang
general
Thanks a lot Sergey
2019-05-18T14:03:42.193900
Bebe
elmlang
general
ur welcome
2019-05-18T14:03:47.194100
Lynne
elmlang
general
It may need a bit of polishing (like removal of `()` from arguments) but I leave it in your hands
2019-05-18T14:04:32.194700
Lynne
elmlang
general
right on!
2019-05-18T14:04:43.194900
Bebe