workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
<@Virgie> I looked at that but the links in the bottom up tab but all the functions were to core library functions that get used everywhere. I suppose this might change if I have an actual performance bottleneck in my code and it isn't just the debugger causing problems.
2019-04-13T07:18:31.118500
Jae
elmlang
general
for benchmarking, is it possible to do it in place or do I need to copy the code into something like a unit test? If it's the latter, while I think it will get things done, it will be time consuming
2019-04-13T07:19:40.118700
Jae
elmlang
general
probably, yes. It's not ideal but I don't think elm can easily do better than this. I would like timing for individual functions but with anonymous functions (and the machinery needed to encode those in JS) that is very hard to do
2019-04-13T07:20:07.119100
Virgie
elmlang
general
<https://github.com/elm-explorations/benchmark> is great for validating Performance assumptions.
2019-04-13T07:20:51.120000
Timika
elmlang
general
it is however time-consuming to create the benchmarks (and tests, to make sure your new implementation is not only faster but also still correct)
2019-04-13T07:21:23.120200
Virgie
elmlang
general
but because you profiled beforehand you know it's probably going to be worth it
2019-04-13T07:21:48.120400
Virgie
elmlang
general
Yeah, there is no replacement for profiling first. :100:
2019-04-13T07:24:20.120600
Timika
elmlang
general
Cool, well I'll know what to try out if my game starts lagging again (hopefully it doesn't). Thanks!
2019-04-13T07:24:46.120800
Jae
elmlang
general
Has anyone else encountered runtime errors from the standard elm libraries? I'm not using any ports or native code, and the only third-party library I'm using is elm-ui, but I'm getting `TypeError: undefined is not an object (evaluating 'domNode.childNodes')` seemingly every single animationFrame.
2019-04-13T08:09:30.122400
Cammy
elmlang
general
<@Cammy> that's an error you'll get if something is messing with the DOM. Do you have any browser extensions installed?
2019-04-13T08:15:58.123300
Earlean
elmlang
general
No, and I'm getting it cross-browser.
2019-04-13T08:16:26.123700
Cammy
elmlang
general
no other JS loaded on that page?
2019-04-13T08:17:15.124000
Earlean
elmlang
general
No, I'm running the elm via elm-live, not even any html page to load any JS with.
2019-04-13T08:17:55.124600
Cammy
elmlang
general
I just tested in Elm Reactor, same error.
2019-04-13T08:18:36.125300
Cammy
elmlang
general
another possibility is the browser moving DOM nodes around because they're nested in an invalid way
2019-04-13T08:19:26.125900
Earlean
elmlang
general
happens with `&lt;table&gt;` sometimes, the browser automatically adds a `&lt;tbody&gt;` node
2019-04-13T08:20:30.126600
Earlean
elmlang
general
nested `&lt;a&gt;` tags are invalid and the browser might move them around too
2019-04-13T08:20:58.127200
Earlean
elmlang
general
you can't put a `&lt;div&gt;` inside a `&lt;span&gt;`, the browser might move that too etc.
2019-04-13T08:22:10.128000
Earlean
elmlang
general
ReactJS added warnings in development to tell you about invalid nesting, but Elm doesn't
2019-04-13T08:22:31.128500
Earlean
elmlang
general
I'm not sure what would cause that it in my code. It's just div's and p's I'm working with. I do have two custom `on` event handlers and am using content editable, but I'm fairly certain nothing is invalid.
2019-04-13T08:27:11.129900
Cammy
elmlang
general
ah, content editable can cause problems
2019-04-13T08:30:25.130700
Earlean
elmlang
general
I removed some of my nesting and it seems ok now.
2019-04-13T08:30:56.131000
Cammy
elmlang
general
Nope, spoke to soon. Ugh.
2019-04-13T08:32:59.131300
Cammy
elmlang
general
`contenteditable` surely gives issues. One way to get around that is wrap the contenteditable element into a custom element. I’m doing something like that, only using textarea and <https://package.elm-lang.org/packages/billstclair/elm-custom-element/latest/> But really the concept still applies
2019-04-13T09:14:16.133300
Hoa
elmlang
general
I’ve heard that it is possible to compile an Elm program with only types (no function definitions), but when I try to do so while designing an api, I get
2019-04-13T10:46:18.134700
Genevieve
elmlang
general
```There is a type annotation for `fromForest` but there is no corresponding definition! 8| myFunc : String -&gt; Int ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Directly below the type annotation, put a definition like: myFunc = 42 ```
2019-04-13T10:46:41.135200
Genevieve
elmlang
general
What am I doing wrong?
2019-04-13T10:47:00.135500
Genevieve
elmlang
general
put a definition below it with `Debug.todo "still need to implement"`
2019-04-13T10:48:04.136300
Cornell
elmlang
general
`myFunc = Debug.todo "still need to implement"`
2019-04-13T10:48:14.136600
Cornell
elmlang
general
Ok so that’s the way?
2019-04-13T10:48:24.136800
Genevieve
elmlang
general
Thanks!
2019-04-13T10:48:30.137000
Genevieve
elmlang
general
no prob!
2019-04-13T10:48:34.137200
Cornell
elmlang
general
hi
2019-04-13T14:18:48.137800
Giselle
elmlang
general
Has anyone worked with the WebGL elm package? It looks like it doesn't support array attributes and I'm hoping to find a way to work around this limitation.
2019-04-13T15:48:32.140000
Jae
elmlang
general
When I try to write `uniform vec2 instanceOffsets[128];` in ```agentVS : Shader AgentVertex AgentUniforms { vcolor : Vec3 } agentVS = [glsl| attribute vec3 position; attribute int instanceIndex; uniform mat4 perspective; uniform mat4 camera; uniform mat4 rotation; uniform vec2 instanceOffsets[128]; uniform vec3 color; varying vec3 vcolor; void main () { gl_Position = perspective * camera * rotation * vec4(position, 1.0); vcolor = color; } |]``` I get a compiler error about how the type annotation doesn't match the GLSL shader
2019-04-13T15:49:40.140200
Jae
elmlang
general
My goal is to try simulating instancing. Aka, I want to draw the same vertices many times but in different locations without needing to call WebGL.entity many times.
2019-04-13T15:52:39.140400
Jae
elmlang
general
I thought I could make this work by creating a mesh that contains the vertices I want to draw duplicated many times. Each set of vertices has a unique `instanceIndex` which I can use to access the `instanceOffsets` array and figure out how to offset a given set of vertices.
2019-04-13T15:55:40.140600
Jae
elmlang
general
The only supported types are: Int, Float, Texture and Vec2, Vec3, Vec4, Mat4
2019-04-13T17:10:34.141100
Dorotha
elmlang
general
128 entities should work fine though.
2019-04-13T17:15:02.141300
Dorotha
elmlang
general
there is also <#C34SVE4MR|webgl> channel
2019-04-13T17:17:16.141500
Dorotha
elmlang
general
Thanks for your comment. The `always a bit overlapping` is very precise.
2019-04-13T19:38:56.141700
Myrna
elmlang
general
is there any date library that does date rendering relative "now". Like X seconds/minutes/hours "..ago". And "yesterday"
2019-04-13T20:31:24.143100
Carter
elmlang
general
<@Carter> <https://package.elm-lang.org/packages/gingko/time-distance/latest/Time-Distance>
2019-04-13T21:03:16.143700
Earlean
elmlang
general
<@Earlean> thanks!
2019-04-13T21:03:59.143900
Carter
elmlang
general
Is there any news of websockets coming?
2019-04-13T21:47:37.144600
Isaiah
elmlang
general
I haven't heard anything about it, but I find they're not too bad to manage with ports. The biggest hurdle seems to be if you need to send binary from the client.
2019-04-13T21:51:54.144700
Claretta
elmlang
general
That’s what I’m doing now, but it would be very nice to have it natively in Elm. Building an XMPP client would be a lot easier then. Elm already has great support for XML marshaling, not to mention AST representation, which is done using the DOM in javascript
2019-04-13T21:57:05.149900
Isaiah
elmlang
general
Mind if I ask what the challenge is with ports? Implementation issues or is it more related to a desire to distribute the client as a library?
2019-04-13T21:59:54.150100
Claretta
elmlang
general
I've written a basic XMPP over websockets server previously so your particular use case is doubly interesting to me. :grin:
2019-04-13T22:01:33.150300
Claretta
elmlang
general
Management of the connection happens in javascript (like stream resumption) and all stanzas need to be converted to json before being sent through ports, which is a lot of extra work for nothing in return.
2019-04-13T22:14:45.153000
Isaiah
elmlang
general
It seems like it should be possible to just serialize the stanzas to strings in Elm and just push those through the port. No JSON encoding needed beyond `string`.
2019-04-13T22:24:33.153200
Claretta
elmlang
general
I built a dummy websocket app for elm-port-examples that has some open/close socket messaging in it: <https://github.com/MattCheely/elm-port-examples/tree/master/websocket> I still need to add a little bit of logic to handle close events, but from what I remember of XMPP, once the port glue is in place, most of the stream state management should be pretty independent of that code.
2019-04-13T22:28:24.153400
Claretta
elmlang
general
Although it's certainly possible I've forgotten some details of the protocol.
2019-04-13T22:28:43.153600
Claretta
elmlang
general
doesnt "elm-lang/websocket" work in 0.19?
2019-04-13T22:29:01.153800
Carter
elmlang
general
its been working great in 0.18
2019-04-13T22:29:11.154000
Carter
elmlang
general
hmm, doesnt look like its in 0.19. Found this though : <https://package.elm-lang.org/packages/billstclair/elm-websocket-client/latest/>
2019-04-13T22:31:42.154200
Carter
elmlang
general
<@Claretta> that’s true, and has me thinking now about what exactly this library is doing for me since xml manipulation is trivial in elm. I’d like to write an xmpp client entirely in elm, but having the websocket initialization in javascript might not be so bad. I’d miss out on having BOSH though. And implementing the auth process won’t be fun
2019-04-13T23:27:41.158000
Isaiah
elmlang
general
Not sure if I missed it in my searches, but has there been any talk about elm’s lack of `FormData.append(name, value, filename);`? In my case I’m trying to upload a blob created from a canvas. I know I could just do it in JS, but I was hoping to do it in elm
2019-04-14T00:55:07.159900
Chae
elmlang
general
<@Chae> <https://package.elm-lang.org/packages/elm/http/latest/Http#filePart>
2019-04-14T01:13:32.160200
Earlean
elmlang
general
I’m aware of that, I am talking specifically about the 3 argument variant. `filePart` doesn’t allow setting the 3rd argument of `FormData.append`. Sorry if am I misunderstanding something?
2019-04-14T01:20:42.160300
Chae
elmlang
general
ah, yes you are correct. there isn't a way to set the filename for a File
2019-04-14T01:32:53.160500
Earlean
elmlang
general
Ok, thank you! And sorry for any confusion. For anyone else that may come across this I ended up doing ``` canvas.toBlob( function(blob) { const namedFile = new File([blob], 'customFileName.jpg'); app.ports.sendScreenshotToElm.send((namedFile); }, 'image/jpeg' ); ``` and then decoding inside elm with <https://package.elm-lang.org/packages/elm/file/latest/File#decoder>
2019-04-14T01:39:28.160700
Chae
elmlang
general
Not sure if that should be documented anywhere (self answered on StackOverflow maybe?), it was surprisingly hard to find. Though I’m not sure how often others will need it either
2019-04-14T01:40:33.160900
Chae
elmlang
general
I’m hoping to draw thousands of entities in batches of 128 (because that seems to be the minimum supported array size). I did a quick benchmark earlier that suggests that if I draw each entity individually with WebGL.entity then the most I can do is 600 entities per animation frame
2019-04-14T01:52:11.161200
Jae
elmlang
general
Anyone play around with gitpod yet?
2019-04-14T03:24:34.161500
Carlo
elmlang
general
Let me ask a better question
2019-04-14T03:24:45.161700
Carlo
elmlang
general
Whats the default dockerfile for newbie elm user
2019-04-14T03:25:02.162100
Carlo
elmlang
general
wunsh/alpine-elm is what im about to try
2019-04-14T03:25:35.162400
Carlo
elmlang
general
Hi! Thanks for the invitation
2019-04-14T08:03:07.163100
Aundrea
elmlang
general
You _could_ do some horrible hacks to use a `Texture` to store `vec2`s potentially...
2019-04-14T08:11:13.163200
Corinne
elmlang
general
Do you know if it is possible to modify the texture without causing a memory leak?
2019-04-14T08:19:45.163400
Jae
elmlang
general
No idea, sorry
2019-04-14T08:20:17.163600
Corinne
elmlang
general
It is not possible
2019-04-14T08:51:41.164000
Dorotha
elmlang
general
I've also been thinking about writing an xmpp client for elm. It would be nice to have all of the utilities for common stanzas even without web socket handling. If you start work on it, definitely post something.
2019-04-14T08:58:08.164300
Lorilee
elmlang
general
I guess one thing I can try is defining a bunch of uniforms, aka ``` uniform vec2 instanceOffset0 uniform vec2 instanceOffset1 ... uniform vec2 instanceOffsetHoweverManyAreAllowed ``` And then combine them into an array within main(). I'm not sure if this has more overhead than it speeds things up though.
2019-04-14T10:21:20.164600
Jae
elmlang
general
if you use mat4 then you only need 16 matrices for 128 vec2 :smile:
2019-04-14T10:22:49.164900
Dorotha
elmlang
general
True, I don't know how much overhead there is with individually addressing each part of a mat4 and constructing a bunch of vecs. Maybe it's faster than my idea. I guess I'll have to do some benchmarking to find out
2019-04-14T10:24:56.165100
Jae
elmlang
general
Nevermind, GLSL doesn't support indexing arrays with values that aren't known at compile time
2019-04-14T12:30:50.165500
Jae
elmlang
general
So `instanceOffsets[instanceIndex]` isn't possible. Only things like `instanceOffsets[5]` is supported (which is useless here).
2019-04-14T12:32:36.165700
Jae
elmlang
general
Hello, is there a neat graphics library, now that elm-graphics doesn't work with 0.19?
2019-04-14T12:41:11.166900
Rosario
elmlang
general
I've found explorations/webgl and joakin/elm-canvas.
2019-04-14T12:41:43.167500
Rosario
elmlang
general
This is the other option I'm considering: <https://package.elm-lang.org/packages/timjs/elm-collage/latest/>
2019-04-14T13:07:43.168200
Rosario
elmlang
general
I see, good to know. Does it mean there is no point in supporting arrays?
2019-04-14T13:28:47.169100
Dorotha
elmlang
general
I could still use them here. Not directly but what I have written now is ```[glsl| attribute vec3 position; attribute float instanceIndex; uniform mat4 perspective; uniform mat4 camera; uniform mat4 rotation; uniform vec2 instanceOffset0; uniform vec2 instanceOffset1; uniform vec2 instanceOffset2; uniform vec2 instanceOffset3; uniform vec2 instanceOffset4; uniform vec2 instanceOffset5; uniform vec2 instanceOffset6; uniform vec2 instanceOffset7; uniform vec2 instanceOffset8; uniform vec2 instanceOffset9; uniform vec2 instanceOffset10; uniform vec2 instanceOffset11; uniform vec2 instanceOffset12; uniform vec2 instanceOffset13; uniform vec2 instanceOffset14; uniform vec2 instanceOffset15; uniform vec2 instanceOffset16; uniform vec2 instanceOffset17; uniform vec2 instanceOffset18; uniform vec2 instanceOffset19; uniform vec3 color; varying vec3 vcolor; void main () { highp int index = int(instanceIndex); mediump vec2 offset = (instanceOffset0 * float(index == 0)) + (instanceOffset1 * float(index == 1)) + (instanceOffset2 * float(index == 2)) + (instanceOffset3 * float(index == 3)) + (instanceOffset4 * float(index == 4)) + (instanceOffset5 * float(index == 5)) + (instanceOffset6 * float(index == 6)) + (instanceOffset7 * float(index == 7)) + (instanceOffset8 * float(index == 8)) + (instanceOffset9 * float(index == 9)) + (instanceOffset10 * float(index == 10)) + (instanceOffset11 * float(index == 11)) + (instanceOffset12 * float(index == 12)) + (instanceOffset13 * float(index == 13)) + (instanceOffset14 * float(index == 14)) + (instanceOffset15 * float(index == 15)) + (instanceOffset16 * float(index == 16)) + (instanceOffset17 * float(index == 17)) + (instanceOffset18 * float(index == 18)) + (instanceOffset19 * float(index == 19)); gl_Position = perspective * camera * rotation * vec4(position + vec3(offset, 0), 1.0); vcolor = color; } |] ```
2019-04-14T13:38:43.169300
Jae
elmlang
general
If arrays are supported then I wouldn't need to do so much copy pasting
2019-04-14T13:38:59.169500
Jae
elmlang
general
With this setup I'm able to call WebGL.entity 200 times and since each call draws 20 instances, I can get 4000 instances total. This is in contrast with 600 WeblGL.entity calls with 1 instance each.
2019-04-14T13:40:35.169700
Jae
elmlang
general
With some benchmarking I imagine I could figure out what is the optimal balance of copy pasting uniforms and calling WebGL but this is good enough for now
2019-04-14T13:41:50.170000
Jae
elmlang
general
(With arrays the code would look like this) ```[glsl| attribute vec3 position; attribute float instanceIndex; uniform mat4 perspective; uniform mat4 camera; uniform mat4 rotation; uniform vec2 instanceOffsets[20]; uniform vec3 color; varying vec3 vcolor; void main () { highp int index = int(instanceIndex); mediump vec2 offset = (instanceOffsets[0] * float(index == 0)) + (instanceOffsets[1] * float(index == 1)) + (instanceOffsets[2] * float(index == 2)) + (instanceOffsets[3] * float(index == 3)) + (instanceOffsets[4] * float(index == 4)) + (instanceOffsets[5] * float(index == 5)) + (instanceOffsets[6] * float(index == 6)) + (instanceOffsets[7] * float(index == 7)) + (instanceOffsets[8] * float(index == 8)) + (instanceOffsets[9] * float(index == 9)) + (instanceOffsets[10] * float(index == 10)) + (instanceOffsets[11] * float(index == 11)) + (instanceOffsets[12] * float(index == 12)) + (instanceOffsets[13] * float(index == 13)) + (instanceOffsets[14] * float(index == 14)) + (instanceOffsets[15] * float(index == 15)) + (instanceOffsets[16] * float(index == 16)) + (instanceOffsets[17] * float(index == 17)) + (instanceOffsets[18] * float(index == 18)) + (instanceOffsets[19] * float(index == 19)); gl_Position = perspective * camera * rotation * vec4(position + vec3(offset, 0), 1.0); vcolor = color; } |] ```
2019-04-14T13:44:29.170200
Jae
elmlang
general
I started writing a client library today and it's coming along quickly. I still have a lot to read in the RFCs though.
2019-04-14T13:52:46.170400
Isaiah
elmlang
general
I see
2019-04-14T13:56:42.170600
Dorotha
elmlang
general
Not a very strong selling point I know. If instancing is supported in WebGL (I'm not entirely sure if it is) then I think it would be much better to support that directly than improve my hack
2019-04-14T14:00:24.170800
Jae
elmlang
general
That one is the sequel of Elm Graphics :slightly_smiling_face:
2019-04-14T14:24:07.171200
Hoa
elmlang
general
Looks really nice. I was reading the docs the other day
2019-04-14T14:24:29.171700
Hoa
elmlang
general
To pick one really depends on what you are after
2019-04-14T14:24:55.172200
Hoa
elmlang
general
There certainly are a lot of RFCs. Once you have a foundation, let me know if you could use some help adding to it.
2019-04-14T17:10:26.172700
Lorilee
elmlang
general
I would also be interested in an Elm XMPP library. I don't have any direct use for it now, but I have some project ideas that I might get around to eventually where it would be nice.
2019-04-14T21:10:59.172900
Claretta
elmlang
general
<@Isaiah> One thing to watch out for in the RFCs if you haven't caught it already is that the stream initialization process is different for websockets vs vanilla XMPP over TCP. Websockets open and close with a single stanza, but in vanilla XMPP there's a `stream` element that wraps every other stanza, and maybe other streams also if you need to create a new stream after auth or TLS negotiation.
2019-04-14T21:13:19.173100
Claretta
elmlang
general
The websocket version is much easier to deal with, IMO
2019-04-14T21:13:34.173300
Claretta
elmlang
general
I forget what BOSH does.
2019-04-14T21:14:09.173500
Claretta
elmlang
general
Here is the start of [elm-xmpp](<https://github.com/ericnething/elm-xmpp>). Figuring out the correct API from Elm is fun, if not a bit challenging. :grin:
2019-04-14T22:07:52.173700
Isaiah