workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
is it because its hard to guarantee length?
2019-05-02T04:30:52.386000
Isaias
elmlang
general
I’m a developer, first and foremost
2019-05-02T04:31:09.386100
Huong
elmlang
general
Isnt `(,)` still a function?
2019-05-02T04:31:36.386600
Isaias
elmlang
general
a frontend dev
2019-05-02T04:32:00.386700
Isaias
elmlang
general
Nope, the tuple constructors were removed in 0.19
2019-05-02T04:32:59.387200
Huong
elmlang
general
Eh, backend, too - whatever is required
2019-05-02T04:33:27.387400
Huong
elmlang
general
Will tuples be removed?
2019-05-02T04:33:31.387700
Isaias
elmlang
general
where do you work? what do you think of it?
2019-05-02T04:34:02.387800
Isaias
elmlang
general
I’m actually at work so I don’t really have bandwidth for general small talk, sorry! We can chat about this later, if you’d like :slightly_smiling_face:
2019-05-02T04:35:12.388000
Huong
elmlang
general
sure
2019-05-02T04:35:26.388400
Isaias
elmlang
general
It’s not really a plan right now, but who knows what the future holds :smile:
2019-05-02T04:35:58.389100
Huong
elmlang
general
id be fine with it
2019-05-02T04:36:09.389300
Isaias
elmlang
general
If they were replaced with `Pair` or maybe some slightly mroe convenient syntax
2019-05-02T04:36:52.390100
Isaias
elmlang
general
what's your issue with tuple syntax ?
2019-05-02T04:37:41.390500
Syble
elmlang
general
`Pair a b` is easier to manage than `(a, b)` on a textual level
2019-05-02T04:38:38.391300
Isaias
elmlang
general
also easier to read because you dont have to parse that the parentheses aren't a subexpression
2019-05-02T04:39:21.392500
Isaias
elmlang
general
<@Isaias> actually I found this Tuple replacement package :smile: <https://package.elm-lang.org/packages/bburdette/toop/latest/>
2019-05-02T04:40:06.393200
Nana
elmlang
general
kind of sounds like what you want
2019-05-02T04:40:48.393400
Nana
elmlang
general
perhaps
2019-05-02T04:41:43.393700
Isaias
elmlang
general
thanks for the tip
2019-05-02T04:42:00.394100
Isaias
elmlang
general
If you reduces tuples to the usage of pairs, it might be sound, but I like to envision the third dimension :monkey_face:
2019-05-02T04:42:29.394700
Syble
elmlang
general
I honestly don't know if Pair 1 2 is clearer than (1, 2)
2019-05-02T04:43:00.395400
Syble
elmlang
general
tuples dont support the fourth dimension atm
2019-05-02T04:43:01.395500
Isaias
elmlang
general
but you can do `(x, (y, z))`
2019-05-02T04:43:22.396000
Isaias
elmlang
general
And also just `Triplet x y z`
2019-05-02T04:43:48.396400
Isaias
elmlang
general
Idk either
2019-05-02T04:44:02.396600
Isaias
elmlang
general
Question: does elm have tail call elim?
2019-05-02T04:44:45.396900
Isaias
elmlang
general
Yes :slightly_smiling_face:
2019-05-02T04:45:23.397200
Timika
elmlang
general
:tada:
2019-05-02T04:45:56.397400
Isaias
elmlang
general
None
2019-05-02T04:47:04.397500
Isaias
elmlang
general
so I have a problem
2019-05-02T04:49:28.397800
Isaias
elmlang
general
So I want to run a bunch of state-dependent computations, but I dont want the dom to constantly rerender because it causes it to crash
2019-05-02T04:54:37.398700
Isaias
elmlang
general
actually... i think i have an idea.. ill repport back how it works
2019-05-02T04:56:01.399900
Isaias
elmlang
general
ok it didnt work
2019-05-02T04:58:58.400200
Isaias
elmlang
general
yeah so essenntially i want a continuously updating model but a `view` function thats only effectively called on animation frame
2019-05-02T04:59:54.401300
Isaias
elmlang
general
i dont really know enough about when elm decides to call view to optimize that
2019-05-02T05:00:46.402200
Isaias
elmlang
general
i dont want to slow my computations to animation frame if i dont have to
2019-05-02T05:01:27.403300
Isaias
elmlang
general
`view` is most of the times called with the next animation frame.
2019-05-02T05:01:38.403400
Jin
elmlang
general
hm.. then maybe its not crashing because of too many dom updates
2019-05-02T05:02:09.404400
Isaias
elmlang
general
A sync render is e.g. done when you handle text inputs.
2019-05-02T05:02:22.404800
Jin
elmlang
general
Maybe you can batch your calculations in one function call? So the model just changes once.
2019-05-02T05:02:49.405200
Timika
elmlang
general
Long running calculations will block your view.
2019-05-02T05:03:26.405900
Jin
elmlang
general
so like i have my model do a random calulation and then emit the next dependent calculation
2019-05-02T05:04:17.406800
Isaias
elmlang
general
so in theory it can essentially reduce to a monad op however i know that in the end the state will still require changing continuously
2019-05-02T05:05:04.407700
Isaias
elmlang
general
so batching more calculations just means more is asked to be done of the elm runtime at once
2019-05-02T05:05:26.408200
Isaias
elmlang
general
You could do some continuation style as explained here <https://discourse.elm-lang.org/t/asynchronous-parsing/3412/3>
2019-05-02T05:06:52.408800
Jin
elmlang
general
I wonder why adoption of elm isnt bigger. Not that i no any figures but it seems the industry is mainly into typescript and React?
2019-05-02T05:08:20.409700
Carter
elmlang
general
(from my POV there should be elm world domination) =D
2019-05-02T05:08:52.410500
Carter
elmlang
general
dunno <@Carter> but i think the world as a whole does move toward improvement but is strongly biased with familiarity
2019-05-02T05:12:52.411500
Isaias
elmlang
general
Its kind of like live rendering an infinitely long file that you continuously parse
2019-05-02T05:13:30.412200
Isaias
elmlang
general
from my point of view, it's mainly WP with jQuery, so imagine how Elm, a FP, would look like to those :smile:
2019-05-02T05:15:42.413000
Syble
elmlang
general
is jquery still used for new projects?
2019-05-02T05:26:39.413600
Isaias
elmlang
general
is it dying
2019-05-02T05:28:40.413900
Isaias
elmlang
general
if it is done by some backend dev.. or if dev have not enough exp.. as main function was `$` (sizle) that now is replaced with `document.querySelector`
2019-05-02T05:32:02.415600
Liza
elmlang
general
honestly I don't know
2019-05-02T05:32:05.415700
Syble
elmlang
general
is it possible to write a `mapN` with lists or does the type system not allow it
2019-05-02T05:46:41.416800
Isaias
elmlang
general
Well, the problem is the target function declaration I guess. AFAIK, there is no variadic functions in Elm
2019-05-02T05:51:05.416900
Syble
elmlang
general
so a type variable cant stand for a function type?
2019-05-02T05:52:27.417100
Isaias
elmlang
general
cant recursive union types work like variadic functions
2019-05-02T05:58:53.417300
Isaias
elmlang
general
It is possible to write a variadic `map`, but, since it has to be type-safe, all lists should have the same type
2019-05-02T05:59:50.417500
Lashawna
elmlang
general
How would you imagine a signature for such a function would look? :thinking_face:
2019-05-02T06:00:02.417700
Huong
elmlang
general
``` mapN: (List a -&gt; result) -&gt; List (List a) -&gt; List result ```
2019-05-02T06:00:41.417900
Lashawna
elmlang
general
Yeah, I meant <@Isaias> :smile:
2019-05-02T06:01:07.418300
Huong
elmlang
general
<@Lashawna> that would be `List.map (List.map f)` right? Just so I have the right mental model in mind
2019-05-02T06:02:01.418500
Huong
elmlang
general
seems like that `mapN` function would pretty much just be `List.foldl`
2019-05-02T06:15:21.418700
Nana
elmlang
general
oh, even just `List.map` :smile:
2019-05-02T06:16:21.418900
Huong
elmlang
general
``` (a -&gt; b) -&gt; List a -&gt; List b (List a -&gt; b) -&gt; List (List a) -&gt; List b```
2019-05-02T06:17:23.419100
Huong
elmlang
general
anyway, long story short: if I hear `mapN` in this context, I imagine a function which takes a list of lists, and a function that has the same amount or parameters with corresponding types as the list of lists. It’s definitely not trivial to express that in Elm types, and I have a hunch it might not be possible at all....
2019-05-02T06:25:40.419300
Huong
elmlang
general
its very cool
2019-05-02T06:30:50.419500
Isaias
elmlang
general
i imagine its related because it has to do with recursive types, I was thinking you might be able to use something like a `Succ` system to determine how many more times a function can be called
2019-05-02T06:32:19.419700
Isaias
elmlang
general
I was thinking about counting with types the other day, and looked for it, but couldn't remember where i saw it before. This is it!
2019-05-02T06:33:00.419900
Isaias
elmlang
general
peano numbers
2019-05-02T06:33:26.420100
Huong
elmlang
general
yeah thats right
2019-05-02T06:33:34.420300
Isaias
elmlang
general
they’re cool stuff, but not super useful in Elm
2019-05-02T06:33:37.420500
Huong
elmlang
general
I think rtfeldman showed me something like it that he wrote
2019-05-02T06:33:48.420700
Isaias
elmlang
general
Yeah, he did a `vector` module with them at some point, I think
2019-05-02T06:35:16.420900
Huong
elmlang
general
"loop/structural invariants that can be enforced at compile time" might make a fun senior thesis
2019-05-02T06:36:16.421100
Isaias
elmlang
general
can i chain cmds? why is there no Cmd.andThen?
2019-05-02T06:40:08.421600
Isaias
elmlang
general
A command is not guaranteed to even lead to a result (ports and navigation are good examples), so chaining them with `andThen` doesn’t really make sense
2019-05-02T06:42:33.422700
Huong
elmlang
general
That’s what tasks are for :slightly_smiling_face:
2019-05-02T06:42:44.422900
Huong
elmlang
general
right... i think i need to better articulate what i want
2019-05-02T06:45:15.423700
Isaias
elmlang
general
Reminded me of this weird job interview question :slightly_smiling_face: <https://www.reddit.com/r/javascript/comments/9vxdkx/was_asked_this_js_interview_question_is_this_even/>
2019-05-02T06:50:15.423800
Lashawna
elmlang
general
In JS anything is possible though :blush:
2019-05-02T06:51:18.424100
Nana
elmlang
general
For better or worse
2019-05-02T06:51:59.424300
Nana
elmlang
general
Haha, I’m not sure about the “for better” part :smile:
2019-05-02T06:54:46.424500
Lashawna
elmlang
general
say you’ve got a large list of `ul` and `li` and I want to be able to click one of them and, for example, expand it or something. I understand I must use an event from `Html.Events` like `onClick`, but upon sending the message how do I know which one of `li` items was clicked?
2019-05-02T06:56:47.426400
Vilma
elmlang
general
<@Vilma> you include some kind of id value in the produced msg to identify which item was clicked
2019-05-02T06:58:34.428200
Earlean
elmlang
general
pretty sure its possible
2019-05-02T06:59:01.428700
Isaias
elmlang
general
didnt look at solution
2019-05-02T06:59:08.429000
Isaias
elmlang
general
speaking of annything is possible: javascript is a minlang
2019-05-02T06:59:31.429300
Isaias
elmlang
general
<http://www.jsfuck.com/>
2019-05-02T06:59:48.429600
Isaias
elmlang
general
I thought as much, but in my case I’m not really sure how I can accomplish this :thinking_face:
2019-05-02T07:01:23.430900
Vilma
elmlang
general
I guess a CSS id works?
2019-05-02T07:01:47.431200
Vilma
elmlang
general
Are your `li`s generated from a list?
2019-05-02T07:02:40.431500
Roberta
elmlang
general
im curious how can `addSubtract(1)(2)(3)` return `0` but `addSubtract(1)(2)(3)(4)(5)(6)`=`0(4)(5)(6)` return a callback after the `(3)` call
2019-05-02T07:02:55.431600
Isaias
elmlang
general
hmm yeah good point, didn't think about the currying :thinking_face:
2019-05-02T07:05:29.431800
Nana
elmlang
general
doesnt mean its not possible if maybe javascript implicitly casts some value between contexts
2019-05-02T07:06:58.432000
Isaias
elmlang
general
yes
2019-05-02T07:07:14.432300
Vilma
elmlang
general
I’m thinking about using `List.indexedMap`
2019-05-02T07:07:23.432600
Vilma
elmlang
general
one thing you could do is return a function with `.valueOf()` set to the answer
2019-05-02T07:08:24.432700
Nana