workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
Lemme see!
2019-05-01T17:41:00.317500
Hoa
elmlang
general
then something like `List.map2 (\small large -> large - small) offsets (List.drop 1 offsets ++ [Bytes.width myBytes]) ` to figure out the sizes of each table
2019-05-01T17:41:29.318100
Virgie
elmlang
general
Indeed I have offset and length for each piece of information
2019-05-01T17:41:37.318200
Hoa
elmlang
general
Looks we have a winner :slightly_smiling_face: Thank you
2019-05-01T17:43:22.319200
Hoa
elmlang
general
Yeah, as long as you have a way of calculating where to start reading (either absolutely by setting `relativeTo = startOfInput` or relatively by using the `position` parser earlier on to get a position you want to use as the relative offset later on), you can use this to run whatever parser you have at that position, and then resume wherever you were before
2019-05-01T17:43:43.319500
Huong
elmlang
general
OK. I think I’m able to go on. Thank you!
2019-05-01T17:45:20.320700
Hoa
elmlang
general
Thanks! I guess this is the downside of "zero config" :face_with_rolling_eyes:
2019-05-01T17:54:05.320900
Yahaira
elmlang
general
Hey folks -- I've built a drag and drop library, primarily for use inside my company. I'd like to be able to generate documentation from the code for others to read. I can't quite figure out how to do that: - I'd be fine publishing it, but it needs ports for certain touch event compatibility. - If I make a separate `package` elm.json, there's no way to install it to my projects. - `elm make --docs` doesn't do anything for `application` types: <https://github.com/elm/compiler/issues/1835> Is there a canonical way to do this?
2019-05-01T20:12:13.324100
Sofia
elmlang
general
<@Sofia> You're not going to be able to publish anything with ports. You could have an npm package for people to use that they could wire up to ports they define in their applications. I don't think you can publish `application` types either, but I've never tried. You'd need to pull that code into a separate `library` elm package.
2019-05-01T20:37:05.325600
Earnest
elmlang
general
instead of the contains selector i just went with the full style: `[style="position: fixed; bottom: 0px; right: 6px; border-radius: 4px; background-color: rgb(61, 61, 61); color: white; font-family: monospace; pointer-events: auto; z-index: 2147483647;"]`. i'm sure it's not the most performant css, but it's not a huge deal for this case
2019-05-01T21:18:06.325800
Latonya
elmlang
general
Writing documentation is outlined in the "writing great docs" link in the package directory under "Resources"
2019-05-02T02:13:42.327800
Isaias
elmlang
general
``` Error: Script terminated by timeout at: author$project$ShapePoker$easyDecision&lt;@http://localhost:8000/:5104:10 A2@http://localhost:8000/:66:24 analyze@http://localhost:8000/:6168:26 elm$random$Random$map&lt;/&lt;@http://localhost:8000/:5779:6 elm$random$Random$map&lt;/&lt;@http://localhost:8000/:5775:15 elm$random$Random$map&lt;/&lt;@http://localhost:8000/:5775:15 elm$random$Random$map&lt;/&lt;@http://localhost:8000/:5775:15 elm$random$Random$step&lt;@http://localhost:8000/:6529:10 A2@http://localhost:8000/:66:24 elm$random$Random$onEffects&lt;@http://localhost:8000/:6538:14 A3@http://localhost:8000/:69:24 loop/&lt;@http://localhost:8000/:2071:7 _Scheduler_step@http://localhost:8000/:1078:13 _Scheduler_enqueue@http://localhost:8000/:1040:3 _Scheduler_rawSend@http://localhost:8000/:986:2 _Platform_dispatchEffects@http://localhost:8000/:2150:3 _Platform_initialize@http://localhost:8000/:1982:2 _Browser_document&lt;@http://localhost:8000/:4012:9 F4/&lt;/&lt;/&lt;/&lt;@http://localhost:8000/:30:33 @http://localhost:8000/:7748:11 ```
2019-05-02T02:51:53.328000
Isaias
elmlang
general
^ I get this error only after I refresh my app a couple times
2019-05-02T02:52:46.328900
Isaias
elmlang
general
and its a runtime error :confused:
2019-05-02T02:53:56.329300
Isaias
elmlang
general
has anyone else had problems with extensive random use?
2019-05-02T02:54:33.329800
Isaias
elmlang
general
That stack trace looks as if it’s hitting an infinite loop in `easyDecision` - might be worth trying to reproduce it as a fuzz test!
2019-05-02T02:57:10.330700
Huong
elmlang
general
huh, thanks!
2019-05-02T03:01:13.330900
Isaias
elmlang
general
i found it, i was using the random monad wrong mapping 2 generated structures instead of one structure, with 2 values
2019-05-02T03:23:49.332200
Isaias
elmlang
general
it lead to an edge case i was too hasty to deal with rn
2019-05-02T03:24:12.332700
Isaias
elmlang
general
i have a similar problem for completely unrelated reasons now
2019-05-02T03:25:36.333300
Isaias
elmlang
general
``` Error: Script terminated by timeout at: _Utils_update@http://localhost:8000/:316:2 author$project$ShapePoker$play&lt;/makeDecision&lt;@http://localhost:8000/:6023:13 A2@http://localhost:8000/:66:24 playGame/&lt;@http://localhost:8000/:6125:7 elm$random$Random$andThen&lt;/&lt;@http://localhost:8000/:5760:15 elm$random$Random$andThen&lt;/&lt;@http://localhost:8000/:5762:12 elm$random$Random$andThen&lt;/&lt;@http://localhost:8000/:5762:12 elm$random$Random$map&lt;/&lt;@http://localhost:8000/:5776:15 elm$random$Random$map&lt;/&lt;@http://localhost:8000/:5776:15 elm$random$Random$map&lt;/&lt;@http://localhost:8000/:5776:15 elm$random$Random$map&lt;/&lt;@http://localhost:8000/:5776:15 elm$random$Random$step&lt;@http://localhost:8000/:6531:10 A2@http://localhost:8000/:66:24 elm$random$Random$onEffects&lt;@http://localhost:8000/:6540:14 A3@http://localhost:8000/:69:24 loop/&lt;@http://localhost:8000/:2071:7 _Scheduler_step@http://localhost:8000/:1078:13 _Scheduler_enqueue@http://localhost:8000/:1040:3 _Scheduler_rawSend@http://localhost:8000/:986:2 _Platform_dispatchEffects@http://localhost:8000/:2150:3 _Platform_initialize@http://localhost:8000/:1982:2 _Browser_document&lt;@http://localhost:8000/:4012:9 F4/&lt;/&lt;/&lt;/&lt;@http://localhost:8000/:30:33 @http://localhost:8000/:7746:11 ```
2019-05-02T03:25:44.333600
Isaias
elmlang
general
so im continually updating the model with random values, is that a no-no?
2019-05-02T03:26:08.334200
Isaias
elmlang
general
this is for an honors project studying betting btw
2019-05-02T03:26:56.334700
Isaias
elmlang
general
That still looks like a similar issue to me - there’s nothing special about random, and it is, in fact, a rather straightforward module (except for all the math) :smile: My guess would still be an edge-case that’s resulting in some sort of loop within `makeDecision` - is it tail recursive, by any chance?
2019-05-02T03:31:37.336400
Huong
elmlang
general
no, but its called by a function thats randomly recursive, so it could be that my check for stopping isnt quite right,
2019-05-02T03:32:42.337200
Isaias
elmlang
general
right now im trying to monitor the number of recursions but my browser crashed xD
2019-05-02T03:33:08.337800
Isaias
elmlang
general
ahh, yeah, could be that `playGame` is randomly (tail) recursive, indeed!
2019-05-02T03:36:32.338400
Huong
elmlang
general
ok, so it doesnt recurse any more than 6 times
2019-05-02T03:37:37.339500
Isaias
elmlang
general
just empirically determined
2019-05-02T03:37:45.339800
Isaias
elmlang
general
so its not that
2019-05-02T03:38:37.340100
Isaias
elmlang
general
so the structure is i have a generator emit a msg, which in update emits a generator of that same message
2019-05-02T03:39:42.341000
Isaias
elmlang
general
its constantly updating itself with newly generated random values
2019-05-02T03:40:04.341600
Isaias
elmlang
general
can I not have update msg itself all the time?
2019-05-02T03:40:24.342200
Isaias
elmlang
general
oh, so it never actually _stops_ or pauses?
2019-05-02T03:40:34.342500
Huong
elmlang
general
nope, its just supposed to continually compute data, and ideally the renderer will give me analytics about its computational process
2019-05-02T03:41:13.343800
Isaias
elmlang
general
if the dom doesn't stall
2019-05-02T03:41:28.344300
Isaias
elmlang
general
YEah, it’s not getting a chance to render :sweat_smile:
2019-05-02T03:41:30.344400
Huong
elmlang
general
should I intersperse it wiht time breaks?
2019-05-02T03:41:47.345200
Isaias
elmlang
general
`Random` acts as a synchronous effect, basically - it gets the request to generate something random, that’s sent to `update`, and `update` request more random data. There are likely calls happening to schedule a render, but since that function just keeps going, it probably doesn’t get a chance to do so
2019-05-02T03:42:52.346500
Huong
elmlang
general
So yeah, interspersing some `Process.sleep`’s every now and then would definitely help!
2019-05-02T03:43:17.346900
Huong
elmlang
general
oh its synchronous
2019-05-02T03:43:52.347800
Isaias
elmlang
general
how many fps should i give it
2019-05-02T03:44:39.348900
Isaias
elmlang
general
Alternatively, you could decide to manage the `seed` yourself, and use that `Cmd`-less API of `Random` by using `step`, and subscribe to `animationFrame` to sync everything up and do up to 60 “loops”/second. So whenever a `tick` comes in, generate your data, update the seed in the model, and return your `( updatedModel, Cmd.none )`
2019-05-02T03:44:49.349200
Huong
elmlang
general
and i could use a time seed
2019-05-02T03:45:30.349500
Isaias
elmlang
general
I dunno, I want really random randomness for the sake of accuracy in the study
2019-05-02T03:45:55.350500
Isaias
elmlang
general
Yeah, or give yourself some initial random seed through `init` if you’re using `element` or `application`
2019-05-02T03:45:57.350600
Huong
elmlang
general
like if it doesn't behave really randomly than how applicable would my results be?
2019-05-02T03:46:18.351600
Isaias
elmlang
general
`Random.generate` uses `step`, too, and uses the current timestamp as the initial seed
2019-05-02T03:46:22.351800
Huong
elmlang
general
so you’re not losing anything
2019-05-02T03:46:28.352000
Huong
elmlang
general
hm...
2019-05-02T03:46:33.352200
Isaias
elmlang
general
If i switch to a cmd less api i have to rewrite a lot of code too, its like all monads
2019-05-02T03:47:22.353100
Isaias
elmlang
general
as far as randomness of `Random` goes, it uses an implementation of PCG which is prettty good
2019-05-02T03:47:26.353300
Huong
elmlang
general
I don’t think you’ll need to change that much
2019-05-02T03:47:39.353900
Huong
elmlang
general
Isn;t there like a basic monad of no effect?
2019-05-02T03:47:49.354400
Isaias
elmlang
general
only the `Random.generate` call, really - the generators can stay
2019-05-02T03:47:53.354700
Huong
elmlang
general
so rather than ```( model, Random.generate yourGenerator )``` you’d have ```let (generatedVal, seed) = Random.step yourGenerator model.seed in ( { model | val = generatedVal, seed = seed }, Cmd.none )```
2019-05-02T03:49:19.356100
Huong
elmlang
general
oh right i can still use generators
2019-05-02T03:49:43.356400
Isaias
elmlang
general
yeah that implementation is already abstracted in my code
2019-05-02T03:50:53.357100
Isaias
elmlang
general
can I have an animation subscription with both the time AND the delta? just curious
2019-05-02T03:53:18.358000
Isaias
elmlang
general
I don’t believe so, although getting the delta is easy if you have the time and store the time of the previous go :smile:
2019-05-02T03:57:30.358500
Huong
elmlang
general
&lt;beginner question&gt;when should I use Browser.element vs Browser.document&lt;/beginner question&gt;
2019-05-02T03:58:37.359200
Isaias
elmlang
general
yeah that seems like the basic way to do that
2019-05-02T03:59:14.359800
Isaias
elmlang
general
Cant you subscribe to both and have them happen at essentially the same time?
2019-05-02T03:59:43.360600
Isaias
elmlang
general
`document` means you take over the entire DOM: it will bind to the `body` tag and replace all of its contents, and allows you to control the page title
2019-05-02T04:00:18.361400
Huong
elmlang
general
oh right
2019-05-02T04:01:20.362800
Isaias
elmlang
general
Does elm distinguish between animation frame and eg physics update frames
2019-05-02T04:02:24.364500
Isaias
elmlang
general
I think the latter is essentially animation frame delta
2019-05-02T04:02:39.365100
Isaias
elmlang
general
So the levels of control (and complexity) are something like this: - `main : Html msg` -&gt; allows rendering a static piece of HTML in a single element - `Browser.sandbox` -&gt; a basic program without effects (no cmds, no subs) - `Browser.element` -&gt; basic program with effects - `Browser.document` -&gt; basic program with effects, represents the entire document including title - `Browser.application` -&gt; the above, + navigation and url control
2019-05-02T04:02:48.365300
Huong
elmlang
general
Why dont they just have like a `Browser.static` instead of changing what main can return
2019-05-02T04:03:43.366000
Isaias
elmlang
general
gradual learning - no need to know about the `Browser` package for the simplest of programs: at that point you’re just writing HTML and some functions to generate that HTML perhaps
2019-05-02T04:05:23.366900
Huong
elmlang
general
Can elm run headlessly?
2019-05-02T04:05:52.367700
Isaias
elmlang
general
so you could start someone of with some exploration in the REPL, then graduate to `main : Html msg` to see something in the browser, then add `Browser` and `sandbox`, etc
2019-05-02T04:05:55.367800
Huong
elmlang
general
yeah, there is `Platform.program` which is like `element` but without `view`
2019-05-02T04:06:10.368300
Huong
elmlang
general
I hugely appreciate how much attention elm gives to the developer experience, pacing, and the like
2019-05-02T04:06:37.368900
Isaias
elmlang
general
in this case though, I'm not sure how much of a learning curve it would be to have a beginner see `main = Browser.static (text "hello world")` versus `main = text "hello world"`
2019-05-02T04:08:50.370800
Isaias
elmlang
general
they already see boilerplate like in the module declaration
2019-05-02T04:09:16.371500
Isaias
elmlang
general
Sure, it’s a small extra step! It’s also a historical thing, too - `program` used to live in `Html`, so `Html.static` would be weird. As a side-advantage, imagine a future world where server-side rendering in Elm becomes a thing - not using the `Browser` package there also makes sense!
2019-05-02T04:10:22.372800
Huong
elmlang
general
yeah it definitely hints at the opportunity to move across other domains, that is why im sort of nitpicking this since i see that it may better organize what main can return to put all frontend output in `Browser`
2019-05-02T04:12:26.374500
Isaias
elmlang
general
but for now, not really a problem
2019-05-02T04:12:59.374900
Isaias
elmlang
general
Yeah, we’ll see how things pan out :slightly_smiling_face: I think the option of using `elm/html` without involving `Browser` etc is pretty sweet, though, I’ve found it a pretty nice path when dealing with students. It wouldn’t be much harder to add `elm/browser` in the mix, but it is another tiny extra distraction :shrug:
2019-05-02T04:15:08.376900
Huong
elmlang
general
you deal with elm students
2019-05-02T04:18:00.377200
Isaias
elmlang
general
what exactly is your role in the elm community? youre on a lot
2019-05-02T04:19:13.378400
Isaias
elmlang
general
Oh, you know, I just hang out on Slack really :sweat_smile:
2019-05-02T04:19:50.379100
Huong
elmlang
general
He is the all-knowing kind oracle :slightly_smiling_face:
2019-05-02T04:19:54.379300
Timika
elmlang
general
<@Timika> that's actually not that far off from my experience
2019-05-02T04:20:13.379700
Isaias
elmlang
general
<@Huong> have you made modules
2019-05-02T04:20:24.380200
Isaias
elmlang
general
Yes every update to a model is a state transition. Reading it back I worded this question rather poorly. Primarily I'm looking for a nice clean way to represent pages without relying on knowledge of the overarching structure, which obscures intent with what I consider to be spaghetti code (or perhaps I should say spaghetti dependencies, but the effect on a human's ability to reason about code is similar)
2019-05-02T04:20:31.380400
Tarsha
elmlang
general
Oh yeah, I did mean this exactly as I wrote it. :heart:
2019-05-02T04:20:38.380700
Timika
elmlang
general
Sure! <http://package.elm-lang.org|package.elm-lang.org> has a few, and there’s a few 0.18 ones I didn’t upgrade because they weren’t really used by anyone. Also a bunch of tooling (`elm-xref`, `elm-coverage`, `elm-json`) which aren’t exactly modules, but, you know, it’s code either way :smile:
2019-05-02T04:22:03.380800
Huong
elmlang
general
tooling--do you mean in the compiler?
2019-05-02T04:23:40.381100
Isaias
elmlang
general
oh are you zwilias there <@Huong>
2019-05-02T04:24:20.381300
Isaias
elmlang
general
no, external things you can download and use. `elm-xref` finds unused code, `elm-coverage` measures code-coverage for `elm-test` (which I’m also involved with), `elm-json` is the newest in the family and allows dealing with `elm.json` files (i.e. installing/upgrading/removing (test)dependencies, etc)
2019-05-02T04:25:13.381600
Huong
elmlang
general
alm-coverage rocks (just missing the --watch flag though :p)
2019-05-02T04:25:31.381800
Syble
elmlang
general
oh awesome
2019-05-02T04:25:55.382000
Isaias
elmlang
general
<@Syble> oh my, that’s a good one! Feel free to make an issue :smile:
2019-05-02T04:26:13.382300
Huong
elmlang
general
<@Huong> why are you so interested in elm? what makes it worthy of your time?
2019-05-02T04:27:31.382500
Isaias
elmlang
general
question: why is there still unzip if there isnt zip? and: why isnt there zip anymore?
2019-05-02T04:28:32.383200
Isaias
elmlang
general
I like the community and the language, so I got a job which involves Elm. Packages and tools are mostly to scratch my own itches, or because I notice a recurring problem on Slack and get tired of dealing with it :smile:
2019-05-02T04:28:49.383300
Huong
elmlang
general
whats your job
2019-05-02T04:29:12.383900
Isaias
elmlang
general
`unzip` is a little harder to write and for whatever reason (in my experience at least), used slightly more often than `zip`. Writing `List.map2 Tuple.pair` is pretty simple! That said, I don’t know if `unzip` should really be in core :shrug:
2019-05-02T04:30:41.385700
Huong