workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
elmlang | general | Yeah, the construction of your `Model` value is wildly different from what the compiler expects. | 2019-03-30T15:33:17.136700 | Timika |
elmlang | general | `{ fruits = Dict.fromList [("Apple", 1), ("Grapes", 0) ]}` | 2019-03-30T15:34:12.137500 | Timika |
elmlang | general | (Note that I used `String` here, not “Fruits” due to the issue explained in my previous comment) | 2019-03-30T15:34:52.138100 | Timika |
elmlang | general | Would it possibly be a good idea to create a function that gives each fruit a string name | 2019-03-30T15:36:13.140000 | Nikia |
elmlang | general | <https://package.elm-lang.org/packages/pzp1997/assoc-list/latest/> is a 1:1 replacement for the core `Dict` that also supports non-comparable keys. Though it has different performance characteristics. | 2019-03-30T15:36:36.140600 | Jin |
elmlang | general | “wildly different” even. :smile: | 2019-03-30T15:38:28.140700 | Timika |
elmlang | general | I try to avoid strings for logic in my programs when I can. Though it would work, I guess. | 2019-03-30T15:39:19.141500 | Timika |
elmlang | general | Yeah so far I just tried using the Dict.fromList line that you posted above to see how I might be able to change it but I'm still getting an error on that line | 2019-03-30T15:59:43.142600 | Nikia |
elmlang | general | I am using react native, but it could be an overkill if you already have native code for the views... I guess at the point is that you want to run Elm in a webview and exchange some data. Probably a subset of the react native bridge should be enough, though I have no idea how to implement it :man-facepalming: | 2019-03-30T17:25:05.142900 | Hsiu |
elmlang | general | At 10 items, it probably doesn’t matter. At 100 items, it probably does. At 1000 items… | 2019-03-30T19:55:27.143300 | Dede |
elmlang | general | `elm make` produces a blank html page | 2019-03-30T21:37:27.143800 | Tamiko |
elmlang | general | I want to convert the maybe-type URL from Url. fromString to Url-type url. What should I do? | 2019-03-30T23:37:14.145700 | Carrie |
elmlang | general | ```
case Url.fromString value of
Just url -> handleUrl url
Nothing -> handleInvalidUrlString value
``` | 2019-03-30T23:38:46.146600 | Dede |
elmlang | general | Depending on your use case, you might instead do something like this:
```
stringValue |> Url.fromString |> Maybe.map handleUrl |> Maybe.withDefault (handleInvalidUrlString stringValue)
``` | 2019-03-30T23:40:19.148500 | Dede |
elmlang | general | thank you very much | 2019-03-30T23:40:54.149000 | Carrie |
elmlang | general | Out of curiosity, how am I able to use a view function that returns Svg msg with Browser.element, which expects its view function to return Html msg? | 2019-03-31T04:21:17.154900 | Natosha |
elmlang | general | I think you would use `Svg.svg` in your `view` which creates `<svg>` node in HTML but still returns `Html msg`, thus making it suitable for `Browser.element` | 2019-03-31T04:25:33.156000 | Lynne |
elmlang | general | In fact, both `Svg` and `Html` are just aliases for `VirtualDom.Node` | 2019-03-31T04:26:26.156700 | Lynne |
elmlang | general | Thanks <@Lynne>. | 2019-03-31T04:52:06.157400 | Natosha |
elmlang | general | I see a lot of recent commits in the elm/compiler repo, is a new compiler version due out any time soon? | 2019-03-31T10:18:50.158800 | Kimiko |
elmlang | general | AFAIK there’s no timeline. Evan is working on a 0.19.1 to fix a few compiler bugs. | 2019-03-31T10:44:11.159700 | Hoa |
elmlang | general | Version bump is here ;) <https://github.com/elm/compiler/commit/b4fe1e1d01531539dd5d528a2e4888e5829cd3b9> | 2019-03-31T13:39:57.160000 | Millie |
elmlang | general | OK, thanks! I'm hopeful it will fix my personal compiler error too | 2019-03-31T14:13:55.160300 | Kimiko |
elmlang | general | So Im making a game right now and I am a bit stuck on what I should do to add multiple random levels. Its a very basic game and basically how it works is there is a balance scale and one end of the scale it has some number of weight that you need to balance on the other side. You use the many items provided to balance it, and once you've balanced it, you do it again with a different number. I want to do this at least 4-5 times. Any tips on how I can have the repetition of tries and random numbers? Resources I should look at or that I can learn from? | 2019-03-31T19:27:15.164300 | Nikia |
elmlang | general | <@Nikia>: for random number generation - <https://guide.elm-lang.org/effects/random.html> ; <https://medium.com/@ckoster22/randomness-in-elm-8e977457bf1b> | 2019-03-31T23:27:01.164900 | Yolando |
elmlang | general | Ellie hasn't worked for me for months | 2019-04-01T01:41:49.165500 | Alia |
elmlang | general | on any of my devices | 2019-04-01T01:41:55.165700 | Alia |
elmlang | general | afaik the site is still working for the rest of the world though? | 2019-04-01T01:42:11.166100 | Alia |
elmlang | general | No, you arent the only one. Hasnt been working for me, and I have seen others say the same thing. | 2019-04-01T01:43:23.166400 | Ashton |
elmlang | general | seems like there might be some geo-blocking happening? | 2019-04-01T01:47:02.166800 | Alia |
elmlang | general | <@Lashawnda> <@Grayce> do you know anything about this? | 2019-04-01T01:49:45.168300 | Alia |
elmlang | general | there has been some discussion about it in <#C408UCWMN|ellie> | 2019-04-01T01:50:03.168700 | Earlean |
elmlang | general | Well I'm in Australia which makes sense for the latency theory | 2019-04-01T01:51:24.169800 | Alia |
elmlang | general | In case you aren’t aware, we have a <#C0K5RJ7LN|gamedev> channel here as well. Join us. :) | 2019-04-01T03:23:40.171500 | Timika |
elmlang | general | Where can I find documentation for "messages with a payload"? I am not sure this is the term the community prefers. I also searched for "parameterized messages", "passing arguments to a message", etc. I only found one place where this is briefly mentioned in <https://github.com/sporto/elm-tutorial/blob/master/en/02-elm-arch/05-msg-payload.md> by <@Carrol>.
I am also interested in why this doesn't come up more often. Perhaps the reason this is undocumented is that it's a rare pattern or because I am missing something obvious. | 2019-04-01T04:16:17.173100 | Maxwell |
elmlang | general | It basically says that "You can send a payload in your message", and shows some code, but there's no other explanation. There's no explanation for how some messages will get a payload from DOM events like onClick, etc., anyway. | 2019-04-01T04:19:05.174600 | Maxwell |
elmlang | general | To clarify, I am not asking how to send a payload in a message. That's clear.
I'm asking where is the documentation for this feature and because apparently there isn't, why is that? | 2019-04-01T04:20:29.176300 | Maxwell |
elmlang | general | I think this is just an odd way of phrasing the common pattern that Message type constructors can take arguments, which I wouldn't describe as a rare pattern at all. I use it every day! | 2019-04-01T04:20:48.176800 | Gertrude |
elmlang | general | Okay, so should I search for Message type constructor then? Is this documented? :slightly_smiling_face: | 2019-04-01T04:21:48.178200 | Maxwell |
elmlang | general | You can see the same patter, for instance, in the Text fields section of the book: <https://guide.elm-lang.org/architecture/text_fields.html> | 2019-04-01T04:21:56.178400 | Gertrude |
elmlang | general | *pattern | 2019-04-01T04:22:02.178700 | Gertrude |
elmlang | general | Thanks! Yeah, I can see the _code_, but no explanation of whether this is a runtime feature, language feature, etc. I'm looking for documentation, basically. | 2019-04-01T04:22:42.179900 | Maxwell |
elmlang | general | it's not specific to message types – that's just a custom type, like many others. see here: <https://guide.elm-lang.org/types/custom_types.html> | 2019-04-01T04:22:58.180200 | Lewis |
elmlang | general | Yeah. Since messages are just another kind of variant type, and variants can take arguments, it's a common pattern for sending a message that contains some data you want handled by your `update` function. I think there's no specific name for it because it's just such a common pattern no one thought to give it one. | 2019-04-01T04:25:43.181900 | Gertrude |
elmlang | general | Okay! Thank you both. :raised_hands: | 2019-04-01T04:31:46.182500 | Maxwell |
elmlang | general | So here's a question: is it even possible to work with Sets of custom types? Sets need to contain comparables, but comparable can't be derived or implemented, and there's no way even to provide my own comparable function | 2019-04-01T05:00:50.184300 | Gertrude |
elmlang | general | There are packages that do it like that. | 2019-04-01T05:01:43.184900 | Jin |
elmlang | general | <@Gertrude> yep, you need to convert your value to a comparable type. There are packages that make this easier to do. But it's certainly not optimal. | 2019-04-01T05:04:14.188000 | Earlean |
elmlang | general | For small sets you can use <https://package.elm-lang.org/packages/erlandsona/assoc-set/latest/> | 2019-04-01T05:05:00.188500 | Earlean |
elmlang | general | I also found this, which seems to be based on AssocList: <https://package.elm-lang.org/packages/Gizra/elm-all-set/latest/EverySet> | 2019-04-01T05:06:57.188900 | Gertrude |
elmlang | general | Oh, I guess looking now they both are | 2019-04-01T05:08:51.189100 | Gertrude |
elmlang | general | I wonder why they both have `map` :thinking_face: | 2019-04-01T05:09:52.189400 | Huong |
elmlang | general | Is there anywhere i can get a slightly more formal / academic description of the elm architecture? | 2019-04-01T05:51:07.190400 | Danika |
elmlang | general | I don't know if that exists. Essentially, what happened is this:
- Elm was FRP
- people started using this pattern for modeling applications
- Elm adopted that pattern and made it a core-concept of the language
I don't know if anyone then tried to express this pattern in a formal way.. | 2019-04-01T06:01:04.190600 | Huong |
elmlang | general | Doesn’t Evan have a dissertation on it? | 2019-04-01T06:19:15.190800 | Agustin |
elmlang | general | I think the dissertation is on Elm itself | 2019-04-01T06:27:36.191000 | Florencia |
elmlang | general | Yes but that must surely have a section on TEA ? | 2019-04-01T06:40:00.191200 | Agustin |
elmlang | general | It might not have been all that well defined back then | 2019-04-01T06:49:21.191400 | Florencia |
elmlang | general | Checked the PDF and neither `TEA` nor `architecture` are there | 2019-04-01T06:51:21.191600 | Florencia |
elmlang | general | the thesis seems to be concerned with FRP quite heavily | 2019-04-01T06:51:57.191800 | Florencia |
elmlang | general | I have Evans thesis, it indeed is just about FRP. Elm was a quite different back then. I’ll try and reach out to him | 2019-04-01T06:55:53.192900 | Danika |
elmlang | general | > This architecture seems to emerge naturally in Elm. Rather than someone “inventing” it, early Elm programmers kept discovering the same basic patterns in their code. | 2019-04-01T06:58:13.193100 | Huong |
elmlang | general | (from the guide) | 2019-04-01T06:58:18.193300 | Huong |
elmlang | general | :shrug: | 2019-04-01T06:58:20.193500 | Huong |
elmlang | general | I do remember Phil Freeman asking about a similar thing, in the context of wanting to refer to TEA in a paper. Let me see if I can dig up that paper, and see how they handled it... | 2019-04-01T07:03:12.193700 | Huong |
elmlang | general | That’d be much appreciated, I want to do the same :) | 2019-04-01T07:04:30.194300 | Danika |
elmlang | general | <https://functorial.com/the-future-is-comonadic/main.pdf> So they just linked to the guide. However, it does give an idea of how to describe TEA in a more formal manner! | 2019-04-01T07:04:51.194500 | Huong |
elmlang | general | This is a brilliant resource, thank you very much! | 2019-04-01T07:06:08.195200 | Danika |
elmlang | general | You're welcome! :smile: | 2019-04-01T07:18:57.195500 | Huong |
elmlang | general | the future is comonadic eh? :face_with_raised_eyebrow: | 2019-04-01T07:48:30.195700 | Nana |
elmlang | general | a little bit of extra history: There was a time before Elm had `html` support. Once `elm-html` appeared, people started using it and discussions about architecture started to emerge. The architecture was mainly about the signal graph. In the end, Evan created a package called `start-app` that formalized this graph that kept appearing. The community started using `start-app` extensively. This was around Elm `0.15`. With `0.16` this pattern was so frequently used that it ended up being adopted as the default pattern in `0.17`. | 2019-04-01T07:48:49.195900 | Maida |
elmlang | general | <@Danika> if you want to dig deeper into the history, I recommend you look at the git history of the `start-app` and of the `elm-todomvc`. | 2019-04-01T07:51:48.196100 | Maida |
elmlang | general | do you think Elm should still be considered FRP now that you can no longer "fold/map over time"? | 2019-04-01T07:53:55.196300 | Nana |
elmlang | general | The blog post announcing 0.17 is titled "A Farewell to FRP" :sweat_smile: | 2019-04-01T08:02:55.196500 | Sharon |
elmlang | general | Not in the academic sense of the word, in that Elm, the language, no longer offers the fundamental building blocks of FRP. However, those building blocks underpin TEA, and the result is functional and - in a sense - reactive. So in a casual sense, I personally don't mind Elm being described as "kind of like FRP", as long as it's clear that we're not talking about FRP in the traditional/academic/scholastic sense of the word. Relevant to those formulations of FRP: <https://www.youtube.com/watch?v=Agu6jipKfYw> | 2019-04-01T08:02:57.196700 | Huong |
elmlang | general | Thanks for reminding me about `start-app` <@Maida>, I have actually seen it before but I forgot about it ^^ <@Huong> do you know if Elm still is FRP "under-the-hood" or has the runtime ditched signals as well? | 2019-04-01T08:11:58.196900 | Danika |
elmlang | general | That's a harder question. If someone were to write a bunch of kernel code, they could build on top of the current runtime to offer the same FRP building blocks Elm pre-0.17 used to offer. Since it would require kernel code (effectively extending the runtime), I think that would answer your question in the negative! Is that a good enough answer? | 2019-04-01T08:18:14.197100 | Huong |
elmlang | general | Good enough for now :) thanks everyone, much appreciated. | 2019-04-01T08:36:31.197700 | Danika |
elmlang | general | Does anyone know of any good examples of `Dict.merge`? I have a situation where I have to merge two records' with nested dicts of types .... :disappointed: | 2019-04-01T09:11:04.198700 | Gertrude |
elmlang | general | Found one: <https://stackoverflow.com/questions/53436370/elm-how-to-merge-two-dictionaries> | 2019-04-01T09:18:37.198900 | Gertrude |
elmlang | general | <@Gertrude> If you need some specific help just ask and give us more info about the problem :slightly_smiling_face: | 2019-04-01T09:23:25.199500 | Florencia |
elmlang | general | Conceptually you have to specify what should happen 1) when a key in left dict but not right, 2) when it's in right but not left, 3) when it's in both | 2019-04-01T09:23:53.200300 | Florencia |
elmlang | general | Yeah, my apologies. I probably would've gone into more detail but I figured the general example would be enough in this case, which it was. :slightly_smiling_face: | 2019-04-01T09:26:17.200900 | Gertrude |
elmlang | general | I fixed a big problem today with `billstclair/elm-svg-button`. It was storing state in messages that were delivered by a subscription via `Time.every`. This messed up my state. Strangely, the example worked before, but my bigger application broke badly. The example works in the new order, and my application works, but the auto-repeat feature, which works fine in the example, does not work in my application.
Here’s the example, as an Ellie: <https://ellie-app.com/58tgQKX3HZma1>
And in its package repository: <https://github.com/billstclair/elm-svg-button>
There are four buttons, The top one increments by one. The second one also increments, but will increment every 1/10 second after a 1/2 second initial delay, if you keep the mouse button pressed. The bottom two buttons do the same for decrement.
I’ve checked that the `Time.every` call is happening in my big application, but it doesn’t repeat, only increments once. Can anyone think of a reason that `Time.every` would wait until the mouse button is released to deliver the first `Msg` to `update`?
The source for the large application is here: <https://github.com/billstclair/zapmeme> | 2019-04-01T14:18:33.209000 | Granville |
elmlang | general | I have a quick question about best-practice in `RemoteData` modeling…I have a model that has two http data calls via `elm-graphql`.
```
type alias Model =
{ appRequest : AppResponse
, mutationResponse : MutationResponse
}
```
I need to handle the loading state of each as sometimes it’s a graphql-query and sometimes it’s a mutation…
Should I wrap those into one field and set it in my update function as a command from the other two commands?
I found myself making a kinda nasty case statement to try to capture both of those scenarios… | 2019-04-01T16:41:47.212800 | Jeanene |
elmlang | general | Hey <@Jeanene>! Have you tried Remotedata.map2? That may help clean it up. I would recommend storing them separately as you have it now and then using map2 to combine them in your view | 2019-04-01T16:44:01.214700 | Sade |
elmlang | general | Haven’t tried using map2--that’s a great recommendation. I’ll refactor with that and see how it feels. :thumbsup::skin-tone-3: | 2019-04-01T16:44:40.214800 | Jeanene |
elmlang | general | Thanks! | 2019-04-01T16:44:44.215000 | Jeanene |
elmlang | general | Awesome, let me know if you have any other questions on that! :smile: | 2019-04-01T16:45:13.215900 | Sade |
elmlang | general | One other option is to create a custom `RemoteData` type that encapsulates the possible states. I like to do this when I’m e.g at first querying one object, then have a mutation to update it. This allows me to show an initial loading spinner, then a pre-filled form that also has its own loading indicator, but that also keeps the form around while sending the request.
This should also be possible with two separate `RemoteData` fields, but there might be impossible states possible. This depends on your use case of course. But custom types are nice in Elm. | 2019-04-01T16:50:17.216100 | Jin |
elmlang | general | I think I may need to lean your direction here, <@Jin>… | 2019-04-01T16:58:12.216300 | Jeanene |
elmlang | general | I thought maybe my problem was that my rendering was taking too long, but removing all the SVG stuff didn’t fix it. It did motivate me to use Lazy to greatly optimize it, but I still don’t get auto-repeating buttons. | 2019-04-01T18:06:34.216600 | Granville |
elmlang | general | Hi everyone, I've been working at the same issue for a long time regarding generating random numbers and I'm just not seeming to get it. What I'm trying to do is randomly select one of these "Fractions" and then convert it to a float, and then compare that float to another float. | 2019-04-01T19:37:40.216800 | Nikia |
elmlang | general | floats are inaccurate to compare, you'd need to see if the absolute value is within some confidence margin.
are you having problems generating the number? generating _random_ numbers or comparing floats? | 2019-04-01T19:42:25.218700 | Ruthann |
elmlang | general | well I created a type with a number of different fractions represented with words, I want to randomly select one of the fractions. | 2019-04-01T19:43:54.220200 | Nikia |
elmlang | general | With that I can then easily assign it a value | 2019-04-01T19:44:14.220700 | Nikia |
elmlang | general | But I cant seem to randomly select one of those Fractions that I have, I have an example of what I tried above. | 2019-04-01T19:44:45.221300 | Nikia |
elmlang | general | so i see you have a random generator but you're not actually generating a number:
<https://package.elm-lang.org/packages/elm-lang/core/latest/Random#generate> | 2019-04-01T19:45:17.221800 | Ruthann |
elmlang | general | so i'd hook up a button to the generate function, it will take the generator, give you back a command and you can tag the msg with your random value | 2019-04-01T19:45:49.222400 | Ruthann |
elmlang | general | My application needs to download a fair amount of JSON data, say 50 MB. This takes a while, so I show a progress message. That part works great! The issue is that there's a noticeable pause at, say, 99% downloaded before Elm draws the result to the screen. I believe it's just that the data is so large, decoding it takes a while. The pause is long enough that some users think the application must have stopped, so I'd like to update the progress message (to, say, "Rendering" and a spinner instead of "Loading" and a progress bar).
As far as I can tell, the only way to do that is to decode the data on a separate step through the event loop. I have this mostly working by using `Task.map (\_ -> <…do decode…>) Process.Sleep 0` to get a task that is immediately ready, but this feels like a hack, and it also feels like it makes the delay even longer (though I haven't timed it).
Is there a better way to approach this? | 2019-04-01T21:33:39.233500 | Christoper |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.