workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
I might benchmark this when I get home. :slightly_smiling_face:
2019-03-20T13:05:26.470400
Timika
elmlang
general
Looking at the `elm/bytes` API, I should be able to do `String -> Bytes` then `Bytes -> Array Int` (decoded as uint8)
2019-03-20T13:06:02.470600
Genesis
elmlang
general
As of now, I push 1426500 ints per second from Elm to JS via arrays of int, a minimal improvement would accumulate to a lot I guess :smile:
2019-03-20T13:06:38.470900
Timika
elmlang
general
If you get some insight by trail and error, I would love to hear your experience :smile:
2019-03-20T13:07:25.471300
Timika
elmlang
general
For you, I guess it would depend on what range of values you use in your ints. If you use the full range then Strings won't help size wise
2019-03-20T13:08:05.471500
Genesis
elmlang
general
The main issue is that not every stream of bytes is valid UT8
2019-03-20T13:09:13.471800
Huong
elmlang
general
But maybe serialisation/deserialisation is faster or whatnot. I learned _not to trust_ my intuition about performance and just benchmark the hell out of ideas like this.
2019-03-20T13:09:40.472000
Timika
elmlang
general
Right! <@Huong> Does the `elm/bytes` `String -&gt; Bytes` encoder do any checking? Or do you think the issue is on the JS side?
2019-03-20T13:10:29.472200
Genesis
elmlang
general
<@Huong> do you have an example from the top of your head where that might be the case?
2019-03-20T13:10:59.472400
Timika
elmlang
general
I don't have much benchmarking experience in Elm, I'll have to look into setting that up
2019-03-20T13:11:07.472600
Genesis
elmlang
general
Shameless plug: <https://github.com/Malax/elmboy/tree/master/benchmarks>
2019-03-20T13:11:22.472800
Timika
elmlang
general
this is a very bare-bones setup you can just steal
2019-03-20T13:11:34.473000
Timika
elmlang
general
`0xf0 0x00` would do it
2019-03-20T13:12:00.473200
Huong
elmlang
general
With ports, things get tricker to benchmark tho.
2019-03-20T13:12:05.473400
Timika
elmlang
general
Ah! You're the `elmboy` person! Great talk (I watched it on youtube) :slightly_smiling_face:
2019-03-20T13:12:15.473700
Genesis
elmlang
general
(i.e. "broken" surrogate pairs)
2019-03-20T13:12:58.474000
Huong
elmlang
general
And JS will error out with broken UTF8? (which makes sense, I don’t miss the days of `char*` at all :P)
2019-03-20T13:13:44.474200
Timika
elmlang
general
Alright, thanks for your recommendations! The array of int route seems simpler to start with. :smile:
2019-03-20T13:15:43.474400
Genesis
elmlang
general
not sure - JS uses UTF-16 so there's another conversion involved there :sweat_smile:
2019-03-20T13:16:13.474600
Huong
elmlang
general
Right, so nothing will explode, however, the bytes representation won't quote match the bytes it came from. And even that is only because bitshifting `NaN` produces 0 :joy:
2019-03-20T13:29:24.474800
Huong
elmlang
general
Does anyone here use Google's Bazel for building their code (either personally or at work)?
2019-03-20T15:22:17.476000
Rosanne
elmlang
general
I don't though I was just looking at an issue related to it - <https://github.com/elm/compiler/issues/1908>
2019-03-20T15:54:03.476800
Huong
elmlang
general
I think I've read something about it before but can't seem to find it...what are the bug fixes in the Elm npm package related to? The Elm compiler or the package itself? Example: `0.19.0-bugfix6`. <https://www.npmjs.com/package/elm>
2019-03-20T16:15:44.478900
Laurena
elmlang
general
The last related commit I've found is this one for `0.19.0-bugfix2`: <https://github.com/elm/compiler/commit/964c62ffd6ac108d8cc004040c43bdc6acb3e7e3>.
2019-03-20T16:17:05.479100
Laurena
elmlang
general
Only relevant to the npm installer itself, the binaries have not changed
2019-03-20T16:20:27.479300
Huong
elmlang
general
Thanks <@Huong>!
2019-03-20T16:21:12.479600
Laurena
elmlang
general
(the actual changes to the npm installer are related to upgrading the `binwrap` installer, in order to not trigger npm audit warnings)
2019-03-20T16:21:58.479800
Huong
elmlang
general
<https://github.com/elm/compiler/pull/1884/files#diff-b88b915bb43bc1305102fc9079bf9907>
2019-03-20T16:22:15.480000
Huong
elmlang
general
Ah, thank you for the details! Those warnings were unnecessarily ominous. :slightly_smiling_face:
2019-03-20T16:23:44.480200
Laurena
elmlang
general
Ooh, interesting, thanks
2019-03-20T16:26:48.480400
Rosanne
elmlang
general
<https://github.com/elm/compiler/issues/984> anyone know if there's any chance this will get revived? Some of the ideas in there (especially rtfeldman's curried update syntax) seem really nice, but I don't know if things have changed since then.
2019-03-20T19:12:24.481500
Vashti
elmlang
general
I was reading [this](<https://www.infoq.com/presentations/software-languages-panel>), and they talked about elm in such nice terms that I wanted to share it with you:
2019-03-21T00:45:43.482400
Yetta
elmlang
general
&gt; Phelps: I think one thing I wanted to touch on is that Rust and Elm - Elm is a programming language designed for the web - I think they both collectively have kind of played off of each other. I don't want to give one more credit than the other. I'm not sure which came first. &gt; Williams: No, Rust 100% borrowed from Elm. We copied them shamelessly and we thank them daily. &gt; Phelps: I thought so, but I didn't want to say it. &gt; Williams: It's true. &gt; Phelps: But Elm, in hindsight, it's kind of like, “Duh”. But essentially, Elm, this programming language that was designed for the web, it's kind of like a gateway drug to Haskell, but yes, but it's much much simpler. Sorry about the drug metaphor, I guess. &gt; Williams: It's cool. It's like hurting cats up here. &gt; Phelps: I know it. But anyway, it did something novel that is laughable, but that it actually gave us real good air messages. It actually did not only give you a short description that you could google, but also a long description that a human would read, and pointed you exactly to the line of code and in a lot of cases, gave you examples of what you should probably do, what it thinks you meant or what you might want to put here instead. And that was a number of years ago when it first did that. If you're fairly new to programming, you might not have noticed because in the last many years, four or five years, other languages have borrowed from that philosophy. And I just think that that's a huge thing. It really set the bar just totally different. And it's funny, because if you write a lot of Javascript, you still to this day get undefined is not a function errors.
2019-03-21T00:45:44.482600
Yetta
elmlang
general
Hi Suppose I have Msg type like this -&gt;
2019-03-21T04:26:05.485000
Sibyl
elmlang
general
None
2019-03-21T04:26:49.485100
Sibyl
elmlang
general
How do I send (Submit 5 Nothing) with the onclick.
2019-03-21T04:27:22.486000
Sibyl
elmlang
general
I tried using onClick FeedMsg &lt;&lt; (Submit 5 Nothing) But could not make it work
2019-03-21T04:28:06.487200
Sibyl
elmlang
general
`onClick (FeedMsg (Submit 5 Nothing))` should work
2019-03-21T04:28:47.487500
Jin
elmlang
general
Thank you. It works.
2019-03-21T04:30:44.488200
Sibyl
elmlang
general
See e.g. here <https://faq.elm-community.org/operators.html> &gt; Function application (by adjacency) is higher priority than all operators and is left-associative:
2019-03-21T04:30:45.488300
Jin
elmlang
general
Hello, I'm having a hard time wrapping my head around routing in elm. I think I (roughly) understand the principles of parsing a Route, however, I don't understand how to actually show the desired content, instead of saving the current URL. In the documentation (<https://guide.elm-lang.org/webapps/url_parsing.html>), this exact part is missing (it still has a TODO in the example code block).
2019-03-21T06:23:50.490800
Shirley
elmlang
general
The documentation in <https://package.elm-lang.org/packages/elm/browser/latest/Browser#application> should help, it also links to the elm-spa-example. The main idea is that you parse a `Url` into some kind of `Route`, and then use this route to update you model. A route often corresponds to a parametrised `Page`. See the main module in the spa-example, specifically <https://github.com/rtfeldman/elm-spa-example/blob/master/src/Main.elm#L156>.
2019-03-21T06:42:32.493800
Jin
elmlang
general
Thank you for your reply, I will have a look at the material you provided
2019-03-21T06:43:07.494200
Shirley
elmlang
general
Anyone has heard of a lib implementing a datastore in elm ?
2019-03-21T06:44:58.494900
Caron
elmlang
general
Well, there’s this: <https://package.elm-lang.org/packages/billstclair/elm-localstorage/latest/>
2019-03-21T09:29:01.495700
Dede
elmlang
general
But also this page talks about using ports to access localstorage and why one might _not_ want to copy the entire localstorage API: <https://guide.elm-lang.org/interop/ports.html>
2019-03-21T09:29:40.496200
Dede
elmlang
general
(above is for <@Caron>’s question from ~3 hours ago)
2019-03-21T09:30:01.496600
Dede
elmlang
general
Thanks :slightly_smiling_face:
2019-03-21T09:30:50.496800
Caron
elmlang
general
As another example, I’ll point you at <https://github.com/jhbrown94/experimental-elm-spa-skeleton/blob/master/src/Route.elm> and <https://github.com/jhbrown94/experimental-elm-spa-skeleton/blob/master/src/Router.elm> This approach makes a distinction between Route (the parsed URL) and the Page you end up on (which could vary due to, e.g., authentication.) It’s a work in progress so I’d caution careful consideration before totally cloning it, but maybe looking at it will help clarify how things work generally…?
2019-03-21T09:31:36.496900
Dede
elmlang
general
I'm not sure that's what I needed, but maybe my initial message was not clear. What I'm looking for is a lib that wraps a type of data and lets you store that type of data from different origins, in order to avoid data duplication and automate gc for the store.
2019-03-21T09:34:59.498800
Caron
elmlang
general
What your use case? I mean implementing that is non trivial and the cost of downloading the library would probably outweigh the benefit in most cases…
2019-03-21T09:35:53.499400
Agustin
elmlang
general
we load the same data for separate reasons, and need a single storage to make sure that modified data is correctly modified in each use case
2019-03-21T10:01:28.500500
Caron
elmlang
general
for reasons unrelated we don't want data to be pushed from the server, so we can't just make a roundtrip with the backend to update data.
2019-03-21T10:03:54.503000
Caron
elmlang
general
normalised data &amp; garbage collection is a bit of a pain with the elm architecture (or redux)
2019-03-21T10:15:01.507600
Shenita
elmlang
general
logic for what data is in use is probably highly specific to your app and very brittle
2019-03-21T10:15:22.508100
Shenita
elmlang
general
probs best just denormalising in a sensible way if memory usage is an issue?
2019-03-21T10:15:42.508600
Shenita
elmlang
general
we do something similar with ports, we send updates out to localstorage, store it, and send the new state back into Elm. Inside elm it is a read-only cache that we can look things up in, to modify it you have to go out a port. You can also avoid localstorage if you want and just keep an in-memory cache in Elm that you pass around
2019-03-21T10:26:44.510300
Alicia
elmlang
general
we put it in our `Session` model that was passed everywhere
2019-03-21T10:27:13.510600
Alicia
elmlang
general
&gt; logic for what data is in use is probably highly specific to your app and very brittle The general logic is complex, but what it's really is a set of rules and each is simple. For instance, say we store meetings. Some meetings are not scheduled. So one rule would be to say that the meetings scheduled this month are in the store, a second rule would be to say that all the unscheduled meetings created recently are in the store, and a third rule would be that the last 3 meetings returned by the search module are in store. In a read model, you can completely separate these 3 requirements, but as soon as you write, the last search result may be modified from the monthly planning. So we need one store representation.
2019-03-21T10:41:01.514700
Caron
elmlang
general
The idea for such a store would be to say that you have a `Store Meeting` to which you can add rules saying what data is appropriate in the store, and what data is relevant to a given rule (e.g. ask the store all the meetings that are in the month). Also you could modify any data in the store without caring about where it is from...
2019-03-21T10:43:18.517600
Caron
elmlang
general
I had the wild hope that one such lib existed, but I'll code it myself otherwise :slightly_smiling_face:
2019-03-21T10:44:04.518200
Caron
elmlang
general
ah ok, that sounds like a good approach
2019-03-21T11:02:23.519100
Shenita
elmlang
general
if you were to have highly relational data though I think that's where you would run into trouble
2019-03-21T11:02:58.519700
Shenita
elmlang
general
hi all! question for everyone. I watched Evan's "The Life of a File" talk two years ago and certainly agree with his premise of building files around a type, its API, and related helper functions, and not trying to keep files artificially short. however, I work on a large Elm codebase and I'm curious about the practical upper limits of file length. how long is too long, and what do you think is practical? do you think code should only be modularized when reuse is a goal?
2019-03-21T11:22:15.524800
Elina
elmlang
general
<@Elina> I like small single purpose files, for example for a Page I have a `Model.elm, Update.elm, View.elm, Api.elm` etc, unfortunately Elm doesn't allow circular references, so this style of separating your files in almost impossible and you're forced to group things together.
2019-03-21T11:30:31.528200
Dayna
elmlang
general
Hey, all! I've written up a blog post on how I'm handling form fields and abstracting them nicely that I believe could be useful to my fellow newbies. I'd appreciate your expert feedback -- especially on ways to improve what I've got! Thanks very much! <https://lytedev.io/blog/elm-form-fields-abstractions/>
2019-03-21T11:31:27.528700
Amie
elmlang
general
too long might have more to do with code complexity than with the actual lines of code.
2019-03-21T12:06:52.529100
Maida
elmlang
general
some code just takes a lot of vertical space but it is simple code.
2019-03-21T12:07:11.529300
Maida
elmlang
general
i've run into that too. we approach it by making Api the file that doesn't import from the others
2019-03-21T12:07:12.529500
Elina
elmlang
general
when implementing an webapp, I like to keep all the code belonging to a page in a single file. The largest I have in my largest app is a little bit over 1k lines.
2019-03-21T12:08:19.529700
Maida
elmlang
general
totally. we're considering a similar approach on the team i'm on, but some of our page files would be over 6k lines if we did it. so i'm curious what the tradeoffs are, and whether my hesitation to make files that long is actually justified or not
2019-03-21T12:10:48.529900
Elina
elmlang
general
with this approach in mind I then proceed in extracting code based on domain. I like to keep the Business Objects each in their own module in a `Data` folder. These modules implement a lot of things related to the module’s object like Json Decoding and Encoding, queries and mutations for things that might be too complex.
2019-03-21T12:11:05.530100
Maida
elmlang
general
then there is a module that captures most of the interaction with the backend, this is where queries are defined. Most functions take a message creator the credentials and produce a Cmd.
2019-03-21T12:12:11.530300
Maida
elmlang
general
there is also a folder with all sorts of helpers. Things that should be in some `elm-community/*-extra` kind of a package.
2019-03-21T12:13:03.530500
Maida
elmlang
general
and then there is the `Widgets` folder that holds complex widgets that I feel are complex enough to warrant their own module. For example, an autocomplete widget or the sidebar (which has some interactivity).
2019-03-21T12:14:39.530700
Maida
elmlang
general
If a page has a complex enough subpart, I also create a folder with the name of that page and extract the complex part into its own module. e.g. I have `Pages.Foo` and `Pages.Foo.Subfoo`
2019-03-21T12:15:49.530900
Maida
elmlang
general
<@Maida> it's like you're describing our codebase—so similar it's scary!
2019-03-21T12:16:24.531100
Elina
elmlang
general
This is similar to how `elm-spa-example` used to be structured
2019-03-21T12:16:42.531300
Maida
elmlang
general
I expect that a lot of codebases somehow end up in this kind of a structure.
2019-03-21T12:17:11.531500
Maida
elmlang
general
hey all, is anyone else seeing problems with Elm installing packages at the moment? We're seeing fairly regular instances of: ``` The following HTTP request failed: &lt;https://github.com/elm/json/zipball/1.1.3/&gt; Here is the error message I was able to extract: HttpExceptionRequest Request { host = "<http://codeload.github.com|codeload.github.com>" port = 443 secure = True requestHeaders =[("Cookie","logged_in=no"),("User-Agent","elm/0.19.0"),("Accept-Encoding","gzip")] path = "/elm/json/legacy.zip/1.1.3" queryString = "" method = "GET" proxy =Nothing rawBody = False redirectCount = 10 responseTimeout = ResponseTimeoutDefault requestVersion = HTTP/1.1 } (StatusCodeException (Response {responseStatus = Status {statusCode = 500, statusMessage = ```
2019-03-21T14:28:21.533100
Brooke
elmlang
general
I haven’t experienced that personally today. I just tried again installing several packages in the elm/ namespace without a problem
2019-03-21T14:53:40.533200
Katharyn
elmlang
general
That looks like GitHub giving 500 errors - fingers crossed it's temporary service degradation
2019-03-21T15:01:17.533400
Huong
elmlang
general
<@Brooke> if this is a recurring/long-term thing, it's probably a good idea to contact gh support - they might be able to look into it :)
2019-03-21T15:03:47.533600
Huong
elmlang
general
hey, can someone point me to some discourse or anything similar explaining why `elm/http` was changed the way it is. I am kinda puzzled by the fact that previously I had a possibility to simply have a single function making my request and either mapping that to `Cmd` or `Task` if necessary. Now it seems a lot like I have to write two functions not to mention that Task path does not offer json decoding by default from what I can tell.
2019-03-21T15:42:54.534000
Floy
elmlang
general
I am aware there is a package `remotedata-http` that seems to be helping with that
2019-03-21T15:45:07.534100
Floy
elmlang
general
just being curious about the design reasons
2019-03-21T15:45:14.534300
Floy
elmlang
general
previous API seemed flexible and nice
2019-03-21T15:45:19.534500
Floy
elmlang
general
new one...it's not IMHO
2019-03-21T15:45:26.534700
Floy
elmlang
general
<https://elm-lang.org/blog/working-with-files> Evan wrote a little about it here. You claim working with `Request` was simple, but there is also the factor of familiarity. Agreed that it's a bunch harder to work with requests as tasks right now. Making requests as a command - which in my experience is the most common use of elm/http, by far - is a lot less circumspect now, though.
2019-03-21T16:01:46.535000
Huong
elmlang
general
yeah, although I have bunch of places in my app where the same request is used somewhere as command while being used as cmd (often paired with other requests) in view initialization
2019-03-21T16:04:25.535200
Floy
elmlang
general
i.e. `MyView.init -&gt; Task.Task Err MyView.Model`
2019-03-21T16:04:41.535400
Floy
elmlang
general
it kinda makes an upgrade super hard :confused:
2019-03-21T16:04:56.535600
Floy
elmlang
general
to the point where I am thinking if there's any real benefit in doing that :wink:
2019-03-21T16:05:17.535800
Floy
elmlang
general
is there?
2019-03-21T16:05:25.536100
Floy
elmlang
general
I am asking for an opinion from people who migrated
2019-03-21T16:07:34.536300
Floy
elmlang
general
I'm currently in the process of building a single abstraction layer for all http stuff in our app, because I want to upgrade to elm/[email protected]. The main reasons I want to be able to do so: - at some point, elm/[email protected] simply won't be supported anymore, and I don't want to hit that wall - support for sending multipart messages with files means we can get rid of the hacks we currently have for file-uploads
2019-03-21T16:09:11.536600
Huong
elmlang
general
yeah, I don't really do uploading, just downloading :confused:
2019-03-21T16:35:17.536900
Floy
elmlang
general
and just in one place
2019-03-21T16:35:20.537100
Floy
elmlang
general
Is there a fundamental difference between `Task.perform mytask` and `Task.perform (Process.spawn mytask)`?
2019-03-21T17:26:48.539200
Isaias
elmlang
general
<@Isaias> the `Process` module isn't really finished. `spawn` gives you a `Task` that won't produce a result.
2019-03-21T18:18:55.541300
Earlean