workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
elmlang | general | Right, and the jscall stuff | 2019-04-04T14:38:03.433700 | Niesha |
elmlang | general | But yeah those are nitpicking | 2019-04-04T14:38:04.433800 | Kris |
elmlang | general | Hello all, I am planning to write a little article on <http://Medium.com|Medium.com> on implementing Schelling’s segregation model in Elm. I’d like to get comments on a draft once I get to that point. Is there a way of doing that on Medium (or some other place)? I am particularly interested in comments on things that I am doing that are not efficient. As the model scales up in size, (NxN cells), it slows down considerably. At each step, N^2 computations have to be done. Thanks!
Here is a reference if you are intereted: <http://jasss.soc.surrey.ac.uk/15/1/6.html> | 2019-04-04T16:12:10.436800 | Jana |
elmlang | general | for just the code a gist could work to find code-level optimizations (rewriting andThen to map2/map3, etc, fusing maps, data structure creation/modification). | 2019-04-04T16:15:24.438300 | Virgie |
elmlang | general | <@Virgie> — good idea. I’ll write something up this evening and post a link. If you could comment, that would be great. | 2019-04-04T16:16:35.439500 | Jana |
elmlang | general | Hi! I wrote a tetris game <https://ellie-app.com/59Thpkzr5G9a1>, but I'm having issues with rotation math - shapes are rotating weirdly. Rotation works by rotating each block around pivot point (visible in "Pause" mode). If someone good at math could take a look, I would appreciate the help :slightly_smiling_face: I put the rotation functions at the top of the code... | 2019-04-04T17:55:27.443200 | Izola |
elmlang | general | I'd suggest you use elm-geometry for this kind of thing, specifically <https://package.elm-lang.org/packages/ianmackenzie/elm-geometry/latest/Point2d#rotateAround>, unless you really want to figure out the math yourself | 2019-04-04T17:57:20.443800 | Virgie |
elmlang | general | I'll take a look. Thanks! | 2019-04-04T17:59:12.444700 | Izola |
elmlang | general | I took a quick look and I think there might be a couple issues. First is that you're using the top-left corner of each block as its `Location`; you're rotating it properly (assuming you want a clockwise rotation), but then *the result is no longer the top left corner* (that corner is now the top *right* corner, if you're rotating 90 degrees clockwise). By treating the result as the top left corner again, you basically add an extra one-block shift to the right. | 2019-04-04T18:16:48.445900 | Janiece |
elmlang | general | Also, for anything but the square piece, the center of rotation does not have integral coordinates - this means that some of the resulting points will not have integral coordinates, and will then get rounded which I think causes additional weirdness | 2019-04-04T18:17:50.446100 | Janiece |
elmlang | general | I suspect it might make more sense to round the coordinates of the center to be integral before doing any rotation | 2019-04-04T18:18:42.446300 | Janiece |
elmlang | general | I'm obviously in favor of you using `elm-geometry` but in this case I don't think it's the actual rotation math (`rotateLocation`) that's tripping you up :smiley: | 2019-04-04T18:21:01.446500 | Janiece |
elmlang | general | Thanks for the input! I'll try to adjust points to the center of block before rotation then convert to grid points after. That might work... | 2019-04-04T18:27:39.446800 | Izola |
elmlang | general | I'm trying out `elm-geometry` right now :slightly_smiling_face: | 2019-04-04T18:27:52.447000 | Izola |
elmlang | general | What is the difference between the `elm` and `elm-lang` packages? | 2019-04-04T18:42:21.447400 | Porter |
elmlang | general | `elm` is for 0.19 and future versions, `elm-lang` is for 0.18 and before | 2019-04-04T18:42:57.448100 | Virgie |
elmlang | general | For example, <https://package.elm-lang.org/packages/elm/core/latest> and <https://package.elm-lang.org/packages/elm-lang/core/latest> both claim to be the stdlib | 2019-04-04T18:43:04.448300 | Porter |
elmlang | general | Ah thank you | 2019-04-04T18:43:06.448500 | Porter |
elmlang | general | It would be really helpful if the page for `elm-lang` said it was for 0.18 and earlier | 2019-04-04T18:43:29.448900 | Porter |
elmlang | general | Can I open a PR for the docs? | 2019-04-04T18:43:35.449100 | Porter |
elmlang | general | Ah, I see the source is now read-only :disappointed: | 2019-04-04T18:44:36.449300 | Porter |
elmlang | general | Thanks again for the insights about origin! I managed to get it working now <https://ellie-app.com/59W5tW5wDSCa1>. I had to use a small "hack" with rounding - if piece is tall I floor float value, otherwise ceil it. I have no idea why, but it works :smile: | 2019-04-04T19:51:02.449900 | Izola |
elmlang | general | Cool, looks good! | 2019-04-04T20:27:56.450400 | Janiece |
elmlang | general | Hi does anyone here have any experience working with slashmili/phoenix-sockets package? | 2019-04-04T22:23:14.451400 | Vesta |
elmlang | general | I am trying to use it to connect to an elixir backend. I can send messages using long-polling to Elixir and change things on the server, however I cannot get Channel.on “event” Function to actually here the “event” | 2019-04-04T22:24:43.453000 | Vesta |
elmlang | general | Has anyone had success with this? | 2019-04-04T22:24:51.453300 | Vesta |
elmlang | general | Or similar trouble? | 2019-04-04T22:25:00.453500 | Vesta |
elmlang | general | <@Vesta> have you set up the ports for it? | 2019-04-04T22:29:05.454100 | Earlean |
elmlang | general | Well… no… I suppose I have not — I thought this was an alternative to that. I was encouraged by the fact that I can send to phoenix without an issue… | 2019-04-04T22:30:49.455200 | Vesta |
elmlang | general | I didn’t find any helpful documentation on doing that with the phoenix-sockets package so didn’t realize it was necessary. | 2019-04-04T22:31:43.456100 | Vesta |
elmlang | general | ah, I see. It's not using websockets, it's just doing long polling | 2019-04-04T22:33:01.456700 | Earlean |
elmlang | general | Right. | 2019-04-04T22:33:11.457100 | Vesta |
elmlang | general | Are you calling `listen` and returning it from your `subscriptions` ? | 2019-04-04T22:33:54.457900 | Earlean |
elmlang | general | what is `model.phxSocket` set to? | 2019-04-04T22:36:50.460300 | Earlean |
elmlang | general | None | 2019-04-04T22:38:35.460800 | Vesta |
elmlang | general | That’s directly from the example. | 2019-04-04T22:39:06.461300 | Vesta |
elmlang | general | and then you use `join` to join the channel you get from `Channel.on` ? | 2019-04-04T22:44:50.461900 | Earlean |
elmlang | general | None | 2019-04-04T22:46:21.462000 | Vesta |
elmlang | general | None | 2019-04-04T22:46:54.462300 | Vesta |
elmlang | general | <@Vesta> where do you update the model with the value in `updatedSocketModel` ? | 2019-04-04T22:47:23.463400 | Earlean |
elmlang | general | In JoinChannel I don’t update it, but I do elsewhere… is that the issue? | 2019-04-04T22:48:45.464500 | Vesta |
elmlang | general | perhaps you want ` ( {model | phxSocket = updatedSocketModel}, newCommand )` | 2019-04-04T22:48:46.464600 | Earlean |
elmlang | general | if you don't use the value returned from a function then it was pointless to call the function as it did nothing | 2019-04-04T22:49:53.465300 | Earlean |
elmlang | general | if you don't update `model.phxSocket` then your `subscriptions` will subscribe you to the old socket which doesn't include joining the channel | 2019-04-04T22:51:02.466200 | Earlean |
elmlang | general | Yes, this makes sense — yet still doesn’t seem to have solved the issue. | 2019-04-04T22:52:47.466600 | Vesta |
elmlang | general | I made another channel2 function that I am calling elsewhere where I definitely am resetting the model.phxSocket also and still no dice. | 2019-04-04T22:53:48.467600 | Vesta |
elmlang | general | I’ve tried using the Push.okOk command as well to see if I can trigger something on an “ok” response. | 2019-04-04T22:54:22.468300 | Vesta |
elmlang | general | You should try to make a simpler example that only joins one channel so you have a good understanding of how the package works before making it more complex | 2019-04-04T22:56:01.469200 | Earlean |
elmlang | general | I suspect you're ignoring return values in other places too | 2019-04-04T22:56:28.469800 | Earlean |
elmlang | general | Well it is only one channel. I just made another function to test other things. | 2019-04-04T22:56:37.470100 | Vesta |
elmlang | general | can you show a complete example? | 2019-04-04T22:57:32.470600 | Earlean |
elmlang | general | Yes, np — I’ve been banging my head on this for a couple days. I’m about to call it quits and just do it with ports and javascript and elm. | 2019-04-04T22:58:19.471400 | Vesta |
elmlang | general | is there archiving mechanism for current elm slack? Some useful conversations may get lost otherwise. | 2019-04-05T00:42:12.476400 | Yolando |
elmlang | general | Does anyone know a safe/reliable way to change the `Elm` global that the compiler outputs? We’ve got a number of small apps which are distributed via CDN and would like to mangle the ID so that different versions of the compiled elm runtime can exist on the same page (assuming that would be possible) | 2019-04-05T00:49:47.480800 | Tisa |
elmlang | general | Consider it an implementation of the "right to be forgotten" | 2019-04-05T01:26:44.481800 | Niesha |
elmlang | general | Anyone got a suggestion why this Url parsing does not work
```
testUrl =
{ fragment = Just "edit", host = "localhost", path = "/index.html", port_ = Just 3000, protocol = Http, query = Nothing }
parsingTests =
describe "parsing Tests"
[ test "simple" <|
\_ ->
Parser.parse (fragment fragmentHandler) testUrl
|> Expect.equal (Just RouteL0)
```
I know that fragmentHandler is returning `RouteL0` | 2019-04-05T04:27:37.485900 | Lynn |
elmlang | general | Do you mean ID of DOM element to which your Elm app is attached (assuming you are talking about `Browser.element` app)? | 2019-04-05T04:28:19.486000 | Lynne |
elmlang | general | If i change to `path = ""` the test does pass | 2019-04-05T04:30:15.486500 | Lynn |
elmlang | general | I think they have multiple compiled Elm apps. If you’re just including them in a <script> tag with no build step like webpack or parcel, then each one is going to expose a global Elm variable.
I think they’re concerned that they’ll all overwrite each other. | 2019-04-05T04:48:06.489500 | Danika |
elmlang | general | I cant say for sure, but if each Elm program has a different name (eg don’t call them all Main) then you might be fine? | 2019-04-05T04:48:44.491300 | Danika |
elmlang | general | <@Lynn> `Parser.parse` matches against the path, query and fragment. The url you're parsing has a path so it won't match | 2019-04-05T04:49:47.492200 | Earlean |
elmlang | general | if you want ignore that this url has a path, set the path to "" before parsing | 2019-04-05T04:51:32.492700 | Earlean |
elmlang | general | Well, that's what I understood as well. I was about to suggest doing this at build time actually | 2019-04-05T04:51:47.492800 | Lynne |
elmlang | general | Changing Elm global implies at least some access to bundling phase | 2019-04-05T04:52:14.493000 | Lynne |
elmlang | general | Including multiple `Elm` bundles on a single page shouldn't be a problem - the exposed apps are automatically merged, assuming each app has a differently named `Main` module. so if you have something like
```<script src="bundle1.js"></script>
<script src="bundle2.js"></script>``` where `bundle1.js` has `Bundle1` as the main module and `bundle2.js` has `Bundle2` as the main module, you end up with a single `Elm.Bundle1` and `Elm.Bundle2`. | 2019-04-05T05:05:01.493300 | Huong |
elmlang | general | Elm _will_ balk at you if the bundles use the same name for the main module, tho | 2019-04-05T05:05:22.493500 | Huong |
elmlang | general | thanks <@Earlean> - that’s what I figured out subsequently | 2019-04-05T05:20:05.494200 | Lynn |
elmlang | general | Is there any way to define that some a is type of Record in funcion signature and then add field to that record?
gg : { a } -> { a | b : String } | 2019-04-05T05:41:37.496700 | Selena |
elmlang | general | Nope, it is not possible to add or remove fields from arbitrary records. One has to be explicit about what is expected and what is returned. | 2019-04-05T05:47:27.497800 | Lynne |
elmlang | general | You can craft something like this:
```
type alias One a =
{ a | one : Int }
type alias Two a =
{ a | two : Int }
gg : One {} -> Two (One {})
gg a =
{ one = a.one, two = 2 }
```
But I doubt it is super useful | 2019-04-05T05:50:55.498400 | Lynne |
elmlang | general | Beat me to it | 2019-04-05T05:51:16.498900 | Danika |
elmlang | general | 2:0 :smile: | 2019-04-05T05:51:25.499100 | Lynne |
elmlang | general | The code above is the same as
```
gg : { one : Int } -> { one : Int, two : Int }
gg a =
{ one = a.one, two = 2 }
```
Maybe it is close to what you were after <@Selena> | 2019-04-05T05:54:12.499900 | Lynne |
elmlang | general | <@Lynne> Yes it helped, thank you very much :smile: | 2019-04-05T06:07:53.500600 | Selena |
elmlang | general | hello everyone!
I have en elm app of type `Browser.element`
can I read the url from this kind of apps? :slightly_smiling_face: | 2019-04-05T06:10:39.500800 | Karrie |
elmlang | general | Browser.application is the only native way to get the URL afaik, you could always use ports though | 2019-04-05T06:15:00.501900 | Danika |
elmlang | general | <@Danika> I have an url like this: `/pages/2/edit/` | 2019-04-05T06:16:02.502400 | Karrie |
elmlang | general | and all I need is the `2` | 2019-04-05T06:16:39.502900 | Karrie |
elmlang | general | would pass the whole path to Elm or just the `2` ? | 2019-04-05T06:16:54.503300 | Karrie |
elmlang | general | I’d personally pass the whole thing and parse it myself. I suppose it depends on your requirements as to how robust the solution needs to be | 2019-04-05T06:17:30.504200 | Danika |
elmlang | general | I just read the same thing here: <https://github.com/elm/browser/blob/1.0.0/notes/navigation-in-elements.md> | 2019-04-05T06:19:18.504600 | Karrie |
elmlang | general | thanks <@Danika> :slightly_smiling_face: | 2019-04-05T06:20:43.504800 | Karrie |
elmlang | general | Aye im on mobile, glad someone else posted the link ^^ | 2019-04-05T06:21:02.505300 | Danika |
elmlang | general | I view forgetting as a constructive activity, like cleaning house | 2019-04-05T07:51:37.505900 | Jana |
elmlang | general | i feel like our old codebase is forcing me to commit horrible crimes^^ bending our redux state into a strongly typed model is so difficult that right now i'm just holding a Value and creating selectors on it that extract interesting information^^ | 2019-04-05T08:10:09.507000 | Emilee |
elmlang | general | maybe it'll at least result in some usable api^^' | 2019-04-05T08:11:35.507500 | Emilee |
elmlang | general | Is there a way of running a shell script to compile an app when the code changes? I prefer not to use webpack or yarn and just work with shell scripts only. (I know, I am retro) :smile: | 2019-04-05T08:20:40.509300 | Jana |
elmlang | general | I've seen `entr` being recommended before <http://eradman.com/entrproject/> | 2019-04-05T08:22:49.509900 | Sharon |
elmlang | general | I used to use <https://github.com/cortesi/modd> back in the days | 2019-04-05T08:23:13.510200 | Jin |
elmlang | general | Though this is not really shell script only | 2019-04-05T08:24:15.510600 | Jin |
elmlang | general | Thanks all, right now I’m looking at `entr`, then I’ll check out `modd` | 2019-04-05T08:51:41.511600 | Jana |
elmlang | general | If you want to go really low-tech, you can do something like this stackoverflow answer: <https://serverfault.com/a/436739> | 2019-04-05T08:58:47.512000 | Dede |
elmlang | general | `entr` looks cool though! | 2019-04-05T08:59:08.512300 | Dede |
elmlang | general | So I have a tricky situation with an API: I need to save a set of `Entries` to the server. Each `Entry` is a single API request, and replies with an `EntryUpdateResponse` which contains the newest list of entries which I use to update the UI model. Thus, I need to batch multiple requests, and then, to ensure that I only use the most recent response to update my data.
I can do the former just fine. Just build a list of entry requests and give it to `Cmd.batch`. But `Cmd.batch` is non-deterministic; there's no order guarantee, and so my UI goes into wrong states because requests resolve out of order.
How I fix? | 2019-04-05T09:06:25.516900 | Gertrude |
elmlang | general | I think you may want to fire off the requests one at a time and build up a "queue" of entries to be saved | 2019-04-05T09:10:15.518400 | Carman |
elmlang | general | Note that even if `Cmd.batch` was processing in order, I don't think that there would any guarantee that the network or web server would keep it, and that responses would come with the same order. So the problem is more an API one. | 2019-04-05T09:13:13.522000 | Velia |
elmlang | general | <@Velia> the original JS version works but just doing a for loop and blocking on each request in turn until it's done, only keeping the last response. It's slow but ... it does work. | 2019-04-05T09:14:56.525000 | Gertrude |
elmlang | general | As <@Velia> says, if you can change the API, I think you should create a way to batch updates, which will lower the time spent establishing http requests (always a good thing) and maybe perform saves as a transaction (often another good thing). | 2019-04-05T09:15:02.525200 | Antonette |
elmlang | general | <@Gertrude> then this is what <@Carman> suggests, do one ~Cmd~ request at a time. | 2019-04-05T09:15:25.526000 | Velia |
elmlang | general | Then again, if you really want to save batches of updates as a sequence, you probably should chain `Task`s instead of batching `Cmd`s. | 2019-04-05T09:16:05.527300 | Antonette |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.