workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
Thank you ! I was just missing the `port` declaration on top of my module :slightly_smiling_face:
2019-03-01T10:02:31.164300
Toni
elmlang
general
the issue already exists, actually : <https://github.com/elm/elm-lang.org/issues/798>
2019-03-01T10:38:25.166000
Toni
elmlang
general
Hey, I'm still trying to publish. I've waited long and even deleted and re-created the GitHub repo, but it is still saying that the tag is not there. Can it be some local cache?
2019-03-01T10:38:38.166100
Dorsey
elmlang
general
Nah, I just tried running it from a container and it's the same.
2019-03-01T10:43:19.166500
Dorsey
elmlang
general
can someone point me to an in-dept explaination of the elm.json? <https://github.com/elm/compiler/blob/master/docs/elm.json/application.md> is not enough for me
2019-03-01T10:45:00.167300
Daysi
elmlang
general
what are you missing ?
2019-03-01T10:45:55.168000
Mindy
elmlang
general
because there isn't anything more to elm.json than this and the <https://github.com/elm/compiler/blob/master/docs/elm.json/package.md> version
2019-03-01T10:46:37.169100
Mindy
elmlang
general
why? A: I get "module not found" errors when `elm make`ing all Elm-apps for my big, multipage app. The "source-directories" in my elm.json are just like in the old elm-package.json. But now the compiler doesn't find modules anymore ...
2019-03-01T10:47:35.170100
Daysi
elmlang
general
Aw, silly me. The repository name did not match package name!
2019-03-01T10:48:15.170300
Dorsey
elmlang
general
None
2019-03-01T10:48:32.170500
Daysi
elmlang
general
"source-directories": [ "app/fas_ui", "app/fas_ui/demo" ],
2019-03-01T10:49:07.170900
Daysi
elmlang
general
so it should just work. After all Elm starts to compile files in the `app/fas_ui` directory but doesn't find modules which live in the same directory and subdirectory.
2019-03-01T10:50:10.172400
Daysi
elmlang
general
I think the message from `elm publish` could be improved and say something like `no repository by this name on <http://github.com|github.com>`.
2019-03-01T10:51:16.173500
Dorsey
elmlang
general
Do those directories directly contain your elm files ?
2019-03-01T10:51:31.174200
Mindy
elmlang
general
does Elm try to look not in the project root but takes the node_modules/.bin/elm as root and looks for node_modules/.bin/elm/app/fas_ui or something?
2019-03-01T10:51:38.174700
Daysi
elmlang
general
Maybe you should put `app/fas_ui/src/elm` in your `source-directories`
2019-03-01T10:51:54.175100
Mindy
elmlang
general
the elm files are in subdirectories
2019-03-01T10:51:56.175200
Daysi
elmlang
general
of these directories
2019-03-01T10:52:04.175500
Daysi
elmlang
general
I think you should put the whole path up to the topmost elm module
2019-03-01T10:53:02.176000
Mindy
elmlang
general
that changed the error message at least :smile:
2019-03-01T10:54:21.176200
Daysi
elmlang
general
now it doesn't find a module which lives in a symlinked directory (we do translations this way by symlinking to the different language directories and building for every language)
2019-03-01T10:55:22.176400
Daysi
elmlang
general
None
2019-03-01T10:56:04.176700
Daysi
elmlang
general
..../elm/I18n is a symlink to a folder
2019-03-01T10:56:53.177500
Daysi
elmlang
general
so maybe I have to adjust the bash `find` command in `node_modules/.bin/elm make $(find app/fas_ui/src/elm/Fas/Apps -name '*.elm' -type f)`
2019-03-01T10:57:42.178000
Daysi
elmlang
general
no idea though how to do that
2019-03-01T11:00:33.178300
Daysi
elmlang
general
isn't there an easy way to say "hey elm: you see that folder? Find all apps in there and bundle them individually into another folder."
2019-03-01T11:01:15.179200
Daysi
elmlang
general
So I just had a random stupid idea… but has anyone seen this sort of thing before or are there good / bad reasons to structure code like this? <https://ellie-app.com/4RGFp2Snr8ca1>
2019-03-01T11:59:49.179900
Buffy
elmlang
general
Yeh update just becomes function application :confused: <https://ellie-app.com/4RGJFvfGbzSa1> ???
2019-03-01T12:05:36.181400
Buffy
elmlang
general
Someone tell me this is stupid before I go and build an app like this, kek.
2019-03-01T12:06:02.181900
Buffy
elmlang
general
Why would you do that? What's the intended benefit?
2019-03-01T12:07:21.182700
Dorsey
elmlang
general
<@Buffy> yeah I had that idea too and people told me it was bad :sweat_smile:
2019-03-01T12:07:26.183100
Nana
elmlang
general
The benefit would be reduced boilerplate I think
2019-03-01T12:08:18.183200
Nana
elmlang
general
Well, IMO the readability of the code is very much reduced that way. This is of course subjective, but the impression is strong on me.
2019-03-01T12:09:16.183500
Dorsey
elmlang
general
No good reason, the idea just popped into my head last night and I was just curious. I watched this… and was curious. <https://www.youtube.com/watch?v=jVeGoqyq5Fs>
2019-03-01T12:09:40.183800
Buffy
elmlang
general
What about this: <https://ellie-app.com/4RGMXYWs5gka1>
2019-03-01T12:10:11.184000
Rosalee
elmlang
general
It’s sort of like how in elm-ui, there used to be a “Seperation” of “styles” and “layout”, but after a while mdgriffith decided against the separation and moved toward co-locating, with a nicer api, styles and layout? Or something?
2019-03-01T12:11:36.184200
Buffy
elmlang
general
<@Rosalee> did you see the second link I posted? <https://ellie-app.com/4RGJFvfGbzSa1>
2019-03-01T12:11:53.184400
Buffy
elmlang
general
I’m just wondering what sorts of issues might crop up from colocating business logic and views. Seems very anti SOC but I’m curious if I’ve been brainwashed by OOP to think a certain way and actually it might be better for some things?
2019-03-01T12:13:18.184600
Buffy
elmlang
general
<@Dorsey> heard.
2019-03-01T12:13:58.184800
Buffy
elmlang
general
I like it :slightly_smiling_face:
2019-03-01T12:15:09.185000
Rosalee
elmlang
general
Not sure I do… but I’d be curious to see what it looks like a little bigger…
2019-03-01T12:16:34.185200
Buffy
elmlang
general
Nice thing about MSG being a union is you can do different things based on the type, but you could still do that here… I’m just not sure how confusing it’d be having business logic mixed in with the views… Like the Elm compiler would still be nice to work with but I’d see business logic issues colocated with view logic issues?
2019-03-01T12:18:27.186100
Buffy
elmlang
general
I’m wondering if anyone who knew elm before like v0.16 could chime in on this, I have to imagine this sort of thing is something people would’ve already tried?
2019-03-01T12:19:03.187500
Buffy
elmlang
general
Two problems to look out for: 1) The debugger doesn't (presently) have good visibility into closures, so using them in messages or the model can make debugging harder. 2) You must be disciplined in never caching model state inside a closure as part of the update, because there can be delays from when messages are sent to when update handles them and you don't want race conditions.
2019-03-01T12:19:14.187600
Dede
elmlang
general
Bam! :exploding_head: there it is! FTW <@Dede>!
2019-03-01T12:20:10.188400
Buffy
elmlang
general
I almost feel a bit of remorse for asking as if I might’ve brought up memories of past pains. Apologies if that’s the case.
2019-03-01T12:21:06.189500
Buffy
elmlang
general
The debugger problem is just an artifact of the moment; hopefully it will go away in time. The other one is more subtle and pernicious :wink:
2019-03-01T12:21:22.189800
Dede
elmlang
general
I went down a similar road recently, no major pain incurred before redirecting.
2019-03-01T12:21:38.190300
Dede
elmlang
general
And to clarify, when you say caching… are you referring to using like Html.lazy or the like?
2019-03-01T12:22:02.190800
Buffy
elmlang
general
Yeah I tried something similar and encountered race conditions
2019-03-01T12:22:11.190900
Nana
elmlang
general
No, something slightly different.
2019-03-01T12:22:34.191400
Dede
elmlang
general
Wow fascinating. I wonder if either of y’all could provide an ellie example? Maybe we could start like an anti-patterns page in Elm that people could look up for answers to similar questions like this in the future?
2019-03-01T12:23:11.191600
Buffy
elmlang
general
Now that I look closer, you implemented the race condition I had in mind :wink:
2019-03-01T12:25:48.192800
Dede
elmlang
general
Imagine someone mashed the button 10 times.
2019-03-01T12:25:56.193200
Dede
elmlang
general
So fast that all 10 happened before the first message made it to update.
2019-03-01T12:26:04.193500
Dede
elmlang
general
The closure is referring to the external model, not to the argument m.
2019-03-01T12:26:18.193900
Dede
elmlang
general
So you only wind up incrementing 1 time instead of 10.
2019-03-01T12:26:28.194200
Dede
elmlang
general
`(\m -&gt; {m | count = model.count + 1}) ` should not refer to `model` but to `m` to avoid this.
2019-03-01T12:26:54.194600
Dede
elmlang
general
If some of your closures capture model info and are delayed until some slow http request returns, you could wind up applying really stale bits of the model, out of order, when the closures finally do run.
2019-03-01T12:28:26.195900
Dede
elmlang
general
Does that make sense?
2019-03-01T12:28:29.196100
Dede
elmlang
general
So an anti-pattern is certainly closing over `model` in `view`.
2019-03-01T12:28:45.196500
Dede
elmlang
general
Man, that’s clear as a summer day! Makes perfect sense!
2019-03-01T12:38:32.197100
Buffy
elmlang
general
That’d be a super easy mistake to make… In which case giving each function their own signature ala the constructors in the Msg union eliminates that ambiguity.
2019-03-01T12:39:38.198200
Buffy
elmlang
general
Yay! More proof TEA is awesome!
2019-03-01T12:40:03.198800
Buffy
elmlang
general
See also the discussion on this discourse thread: <https://discourse.elm-lang.org/t/message-types-carrying-new-state/2177>
2019-03-01T13:04:31.199000
Carman
elmlang
general
Richard Feldman's response in particular is worth reading
2019-03-01T13:05:07.199300
Carman
elmlang
general
I started writing Elm in v0.15. Happy to answer questions about how things were done in "the old days"
2019-03-01T13:07:30.199500
Carman
elmlang
general
In elm/time, why is `now` a `Task x Posix` and not a `Task Never Posix`?
2019-03-01T14:42:00.200300
Angella
elmlang
general
It makes it easier to combine with other tasks
2019-03-01T14:47:22.201000
Carman
elmlang
general
A `Task x Posix` can never fail (similarly to how a `Maybe a` must be nothing and a `List a` must be empty)
2019-03-01T14:48:33.201900
Carman
elmlang
general
Taking `List a` as an example: ``` empty1 : List a empty1 = [] empty2 : List Never empty2 = [] ```
2019-03-01T14:49:24.202600
Carman
elmlang
general
`empty1` can more easily be combined with other types of lists. You could easily say `[1, 2, 3] ++ empty1` or `List.sum empty1`
2019-03-01T14:50:51.203800
Carman
elmlang
general
while if you wanted to do that with `empty2` you'd have to first map the `never` function
2019-03-01T14:51:43.204300
Carman
elmlang
general
This is the same reason Html snippets with no event handlers are usually given the type `Html a` rather than `Html Never`
2019-03-01T14:52:29.205100
Carman
elmlang
general
It would be nice if we could write a version of Task.perform that could somehow understand that. How might that work? I guess the type would need to somehow say, "I'll only accept something with an unspecified type parameter"? I'm trying to wrap my brain around that.
2019-03-01T15:08:53.210700
Angella
elmlang
general
It does?
2019-03-01T15:17:50.210900
Carman
elmlang
general
`Task.perform` works with `Time.now` even though it is a `Task x Posix`
2019-03-01T15:18:11.211100
Carman
elmlang
general
See <https://ellie-app.com/4RKDqH89v4Sa1> for a live demo
2019-03-01T15:18:19.211300
Carman
elmlang
general
the autolocking of topics on Elm's Discourse after 10 days seems a bit aggressive. example: i just watched Dan Abrams' talk in Oslo from 1 week ago and was compelled to explore his ideas further, but couldn't post in his reference topic that's just 1 month old: <https://discourse.elm-lang.org/t/elm-media-control-api-proposal/3006>
2019-03-01T16:56:01.214400
Jarvis
elmlang
general
another example is that i used someone's Parent-Child proposal heavily in production and i had some feedback, found the Discourse topic where they debuted it, but was unable to provide feedback because it was a couple months old.
2019-03-01T17:10:03.218100
Jarvis
elmlang
general
can anyone point me on the right direction, I am trying to convert someone else's library that never was updated from 0.18. In the 0.18 code they were encoding a list of Value (JSON "Value") using Encode.list [ Value, Value etc. ]. The 0.19 version of Encode requires you to supply the encoder and list. What encoder would be used to encode a list of JSON Value?
2019-03-01T17:24:42.223800
Flossie
elmlang
general
<@Pam> E.list takes (a -&gt; Value) so wouldn't identity function be sufficient?
2019-03-01T17:27:34.224300
Jarvis
elmlang
general
you have List Value, so you need a function (Value -&gt; Value)
2019-03-01T17:27:53.224700
Jarvis
elmlang
general
I'm not sure .. I will try it.
2019-03-01T17:28:26.225300
Flossie
elmlang
general
Yeah, that did satisfy the compiler. No idea yet if the end result is correct, but thanks. At least I have something to work with.
2019-03-01T17:30:50.226500
Flossie
elmlang
general
it's one thing i like about this sort of type system. you see the signature `list : (a -&gt; Value) -&gt; List a -&gt; Value`, you know you have a List Value, so you substitute the other `a` with `Value` and see you just need a function `Value -&gt; Value`.
2019-03-02T02:25:10.229000
Jarvis
elmlang
general
as opposed to shopping for a method on the datastructures that might do what you want
2019-03-02T02:25:57.229900
Jarvis
elmlang
general
for some reason it took me a while to appreciate it
2019-03-02T02:26:52.230100
Jarvis
elmlang
general
Hi, I'm using the elm/svg package and I want to render an image inside some svg. I figured something like this would work `Svg.image [ Html.Attributes.src "image.png", Html.Attributes.width 100, Html.Attributes.height 100 ] []` but nothing appears. I looked at some html examples online and they seem to be including an `xlink:href="image.png"` attribute in their image. The `Html.Attributes` module doesn't seem to have that so what do I do instead?
2019-03-02T05:19:27.231600
Jae
elmlang
general
<@Jae> you can use `Html.Attributes.attribute` to put any arbitrary attribute
2019-03-02T05:20:36.232300
Lynne
elmlang
general
Ah, I didn't notice that. Thanks!
2019-03-02T05:20:55.232600
Jae
elmlang
general
Oh, also there is a Html.Attributes.href (not xlink:href) but when I use that I get a runtime exception with the message "TypeError: Cannot assign to read only property 'href' or object '#&lt;SVGImageElement&gt;'". Is this a known bug?
2019-03-02T05:23:01.234700
Jae
elmlang
general
I don't know much about SVG but I can imagine that one is required putting a namespaced attribute (xlink:href) and hence setting just href may be prohibited
2019-03-02T05:26:40.235600
Lynne
elmlang
general
There is also `Svg.Attributes.xlinkHref` - that might by something you are actually after <@Jae>
2019-03-02T05:28:38.236200
Lynne
elmlang
general
That can't be used inside Svg.image though. Svg.image expects Html.Attributes
2019-03-02T05:30:17.236800
Jae
elmlang
general
Both `Html.Attribute` and `Svg.Attribute` are type aliases for `VirtualDom.Attribute`, so that can't be true <@Jae>
2019-03-02T05:32:28.237600
Lynne
elmlang
general
Dang, I never realized that. That solved my problem then, the image appears. Thanks!
2019-03-02T05:33:28.238200
Jae
elmlang
general
I'm looking for approaches to lazily populating my model based on the view. In short, one of my views needs to display the asciidoc-generated HTML from a string in my model. The natural place to request the (relatively expensive) generation is when the view actually needs it, but since generation requires sending a message out a port, the view - as far as I can tell - can't make the request. Other approaches I can think of (e.g. having my update determine when a URL change will require the generation) require putting knowledge about specific views in places besides the view. Any ideas on how I can make the generation request only when the view actually needs that data?
2019-03-02T06:25:23.242700
Winnie
elmlang
general
Do you parse URL in your `view` function now and render something depending on what you parsed? Or how does your app work currently?
2019-03-02T06:33:44.243100
Lynne
elmlang
general
yes, the URL is stored in the model and I sort out what to render in the view based on that. It's all taken pretty directly from the navigation documentation for 0.19.
2019-03-02T06:36:37.243300
Winnie