workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
anyway, yes you can do that with Elm with ports and/or web components
2019-04-04T05:13:18.366000
Nana
elmlang
general
the header at the very top is a live demo
2019-04-04T05:13:20.366200
Fidela
elmlang
general
Seems like a custom html element that wraps the library might be the way to go here
2019-04-04T05:15:00.366900
Danika
elmlang
general
that's good to hear, so I guess we still have agency over the DOM we need to control, & could hook into Elm-generated DOM elements to draw to? e.g. a <canvas> for deck, <svg> for d3?
2019-04-04T05:15:08.367000
Fidela
elmlang
general
as in <https://guide.elm-lang.org/interop/custom_elements.html> ?
2019-04-04T05:16:05.367300
Fidela
elmlang
general
yes
2019-04-04T05:16:32.367400
Nana
elmlang
general
good to hear, I think I will try to implement 2 POCs (one for each framework) to start with :slightly_smiling_face: thanks
2019-04-04T05:19:07.367600
Fidela
elmlang
general
Aye, I’ve not used them personally so I can’t be much help but I’m quite sure this is the way to go
2019-04-04T05:20:35.368500
Danika
elmlang
general
sure, I'll give that a more thorough look, thank you
2019-04-04T05:20:59.368900
Fidela
elmlang
general
I might have disabled hardware acceleration for Chrome :sweat_smile:
2019-04-04T05:22:28.369000
Nana
elmlang
general
You use `sysconfcpus -n 1` for CI or in general on your dev machine?
2019-04-04T05:28:57.369300
Lynn
elmlang
general
everywhere
2019-04-04T05:52:13.369600
Florencia
elmlang
general
Cool header! Here on Safari works smoothly :slightly_smiling_face:
2019-04-04T05:56:03.370400
Hoa
elmlang
general
<https://www.meetup.com/fr-FR/Meetup-Elm-Paris/>
2019-04-04T06:34:45.370900
Valeria
elmlang
general
<https://www.meetup.com/chicago-elm/>
2019-04-04T06:58:56.371300
Hoyt
elmlang
general
Is it possible to trigger a `Msg` in my `init` somehow? Or at least on program start?
2019-04-04T08:43:12.373400
Gertrude
elmlang
general
I'm using elm-uuid so I can create some unique IDs for something and I'm puzzling how to pre-populate the first value so I can use it in some other update branches
2019-04-04T08:48:41.374200
Gertrude
elmlang
general
Sure you can, through a `Cmd` or directly by calling `update` in `init`.
2019-04-04T09:05:39.374800
Antonette
elmlang
general
I don't know elm-uuid, but I'd wager that if they require you to seed some values through side-effects, there must be a function to get a `Task` or `Cmd` you can use to initialize your model.
2019-04-04T09:07:27.376600
Antonette
elmlang
general
There, look at this:
2019-04-04T09:08:01.376800
Antonette
elmlang
general
<https://package.elm-lang.org/packages/danyx23/elm-uuid/latest/Uuid#uuidGenerator>
2019-04-04T09:08:12.377100
Antonette
elmlang
general
I wound up doing this: ``` send : Msg -&gt; Cmd Msg send msg = Task.succeed msg |&gt; Task.perform identity ```
2019-04-04T09:09:22.378400
Gertrude
elmlang
general
So, this is a `Generator Uuid` ; `Generator` is a type that can be used with `Random.generate` <https://package.elm-lang.org/packages/elm-lang/core/latest/Random#generate> to give you a `Cmd msg` that gets a value of the type the `Generator` provides (in this case a `Uuid`).
2019-04-04T09:10:07.379300
Antonette
elmlang
general
as it turns out I can't use UUIDs for this anyway. XD
2019-04-04T09:10:59.380100
Gertrude
elmlang
general
I need instead to somehow make unique integer IDs. :stuck_out_tongue:
2019-04-04T09:11:15.380700
Gertrude
elmlang
general
Well, at least now you know how to get one when needed :wink:
2019-04-04T09:11:16.380800
Antonette
elmlang
general
Depending on how unique you want your ids to be, a `Generator Int` could do the trick.
2019-04-04T09:13:08.382600
Antonette
elmlang
general
<https://package.elm-lang.org/packages/elm-lang/core/latest/Random#int>
2019-04-04T09:13:36.382800
Antonette
elmlang
general
Yeah. The issue is I have this list of "Entries" and I need to make sure that when I create a new one as a placeholder, I need to give it an id that doesn't match any of the others.
2019-04-04T09:14:41.384600
Gertrude
elmlang
general
With a `Generator` however, there is always a slight chance of picking the same number twice, so it might be a good idea to not just blindly accept any number it spits out, or do something a bit more unique-y like maintaining a list of available ideas in which you pluck one each time, and maybe add one back once you've thrown it out.
2019-04-04T09:14:56.385200
Antonette
elmlang
general
Fortunately, I have the ability to query for the latest entry, so I will just grab that and add one.
2019-04-04T09:15:01.385400
Gertrude
elmlang
general
It's SQL sequential IDs so this should work, since I don't actually even send that ID back to the backend, it's just there to prevent edit collisions
2019-04-04T09:15:46.386700
Gertrude
elmlang
general
The only downside to this plan is when you reach the highest possible `Int` ; in which case the "recyclable" list of available ids may do the trick.
2019-04-04T09:15:52.387000
Antonette
elmlang
general
If you want to prevent edit collision, I'd advise you use a way to distinguish "persisted" ids from "draft" ids.
2019-04-04T09:16:47.387800
Antonette
elmlang
general
(like an `Id x y` type: `type Id x y = Draft x | Persisted y`)
2019-04-04T09:17:36.388900
Antonette
elmlang
general
yeah. currently the largest ID is in the 1mil range, and we accrue about ~500 new IDs per day.
2019-04-04T09:19:43.389800
Gertrude
elmlang
general
Then the `type Id x y = Draft x | Persisted y` might be just the trick. You don't have to start your draft increment from the highest know ID, and you have a way to easily distinguish between persisted and draft elements.
2019-04-04T09:21:03.391200
Antonette
elmlang
general
Hmm. Could do.
2019-04-04T09:21:32.391400
Gertrude
elmlang
general
but on the flipside, it will, at present usage, take over 11,000 years to hit the ID cap of an Elm Int max size.
2019-04-04T09:23:24.392500
Gertrude
elmlang
general
each entry is also specific to a date, so it only has to be unique against other entries on that date, which further prevents collisions. I've probably been over thinking this.
2019-04-04T09:27:42.393600
Gertrude
elmlang
general
As long as you don't get oddities from an id being set on a draft while an element is persisted in the database with the same id, you should be fine I think.
2019-04-04T09:29:26.394900
Antonette
elmlang
general
Yeah. When new entries are saved we don't send the ID.
2019-04-04T09:29:58.395200
Gertrude
elmlang
general
and saving an entry triggers a refresh response of the entire list of entries from the backend, so that they once again reflect whatever's in the data base.
2019-04-04T09:30:46.396300
Gertrude
elmlang
general
Then my advice is: don't overthink :wink: you'll still be able to change it later if you need something more robust anyways.
2019-04-04T09:31:19.396900
Antonette
elmlang
general
Luke got me this list <https://www.meetup.com/topics/elm-programming/all/> which is decent!
2019-04-04T09:48:52.397100
Marcellus
elmlang
general
just now I learned a thing: a Msg is sometimes a function and sometimes a value, and so Elm's type inference will assume the latter if you try to pass one as a generic value.
2019-04-04T09:51:35.398600
Gertrude
elmlang
general
So if you have a message `EditEntry String Entry`, and you pass `EditEntry` to a function that expects a `msg` generic type variable, it will not realize that `EditEntry` is a constructor, and so if you then try to give it arguments it complains that it is not a function.
2019-04-04T09:53:01.400300
Gertrude
elmlang
general
You have to make explicit that you're taking a constructor function for a msg: `(String -&gt; Entry -&gt; msg)` will work.
2019-04-04T09:53:41.401100
Gertrude
elmlang
general
The way I see it is that `msg` is a generic value/function/whatever for Elm. If you use `Msg` the compiler can be more precise
2019-04-04T09:54:44.401900
Hoa
elmlang
general
makes sense ?
2019-04-04T09:55:00.402300
Hoa
elmlang
general
yeah. In this case I have not yet refactored such that I can refer to Msg directly in the function without cyclic dependency. This may be a good moment to fix that.
2019-04-04T09:55:22.402800
Gertrude
elmlang
general
I have this "non optimal" use case where i would like to call java code from elm. I found "TeaVM" that lets you compile java to .js. So i guess it would be doable with elm ports. But, i wonder if theres an even better solution?
2019-04-04T10:04:04.404800
Carter
elmlang
general
Java code? You're running it on the backend?
2019-04-04T10:05:59.405100
Niesha
elmlang
general
Just make it a REST API call.
2019-04-04T10:06:18.405600
Niesha
elmlang
general
yeah that too. But i would like to call java code clientside
2019-04-04T10:06:24.405800
Carter
elmlang
general
How would you run Java on the browser?
2019-04-04T10:06:37.406300
Niesha
elmlang
general
Well, thats the thing - i dont want to do that
2019-04-04T10:06:40.406400
Carter
elmlang
general
Theres that TeaVM. I compiles java to js.
2019-04-04T10:07:03.406900
Carter
elmlang
general
so through elm ports id be able to call it
2019-04-04T10:07:16.407200
Carter
elmlang
general
its just one function but involves quite a bit of types
2019-04-04T10:08:04.407600
Carter
elmlang
general
(classes/intefaces as java calls them)
2019-04-04T10:08:18.408000
Carter
elmlang
general
<@Carter> sounds like you want a fork of TeaVM (or in fact plain GWT) that transpiles to Elm directly...
2019-04-04T10:12:59.408700
Corinne
elmlang
general
Note their docs though: &gt; If you are a JavaScript developer who is satisfied with JavaScript, TypeScript or even elm, you probably won’t need TeaVM.
2019-04-04T10:13:35.409400
Corinne
elmlang
general
well, i need to share java code between server and client
2019-04-04T10:15:00.410300
Carter
elmlang
general
I agree with <@Niesha> here - API is the way
2019-04-04T10:17:07.410700
Corinne
elmlang
general
(unless you want to use a Java Applet of course :laughing: )
2019-04-04T10:17:59.411000
Corinne
elmlang
general
Hey folks
2019-04-04T10:35:57.411300
Willodean
elmlang
general
I am back writing Elm once again!
2019-04-04T10:36:06.411700
Willodean
elmlang
general
I wrote a Modal yesterday and could use feedback on the approach
2019-04-04T10:37:32.412400
Willodean
elmlang
general
I used the krisjenkins style type for the Modal
2019-04-04T10:37:54.413000
Willodean
elmlang
general
And it worked fine. I had a button in the UI that sends a message with my Modal type inside
2019-04-04T10:38:27.414100
Willodean
elmlang
general
Problem is, it doesn't sync with the model after it fires the first time
2019-04-04T10:38:53.414900
Willodean
elmlang
general
So I end up with something like this
2019-04-04T10:39:07.415300
Willodean
elmlang
general
``` type Model = Model { ...stuff , modalState = Toggle , modalView = Model -&gt; Modal Msg } type Msg = ...stuff | OpenModal (Model -&gt; Modal Msg) | CloseModal ```
2019-04-04T10:40:09.417100
Willodean
elmlang
general
Which feels very unElm
2019-04-04T10:40:45.417500
Willodean
elmlang
general
It works for now, but I would very much appreciate a suggestion
2019-04-04T10:44:57.419600
Willodean
elmlang
general
is it generally necessary to expose anything but `main` from your `Main` module?
2019-04-04T10:46:26.420100
Gertrude
elmlang
general
No, you should be able to expose just `main`
2019-04-04T10:47:55.420200
Carman
elmlang
general
I thought so. was wondering why I was bothering to export anything else but I think it's just something elm-format did
2019-04-04T10:51:20.420400
Gertrude
elmlang
general
if you want to use function from your Main module in the repl, you'll need to expose them :slightly_smiling_face:
2019-04-04T10:54:31.420700
Sharon
elmlang
general
That is a problem. I think we need some more information to figure out why
2019-04-04T11:02:10.421000
Sharon
elmlang
general
Is it maybe possible to share an example on <http://ellie-app.com/> ?
2019-04-04T11:03:34.421200
Sharon
elmlang
general
:wave: Hi! Until Monday, I’d never written any code to put pixels on a website, only backend data engineering work. I went through the Elm tutorial and got from zero ( + only a bit of FP experience, though lots of interest) to making a test site that displays random emoji (wheee, types) on click in one day! I’m so glad elmlang exists, and really excited to make projects with a beautiful language that has a kind community. :heart:
2019-04-04T12:18:47.424700
Diedre
elmlang
general
Hi, I when running `elm install mpizenberg/elm-debounce` I consistently get the following error ```-- CORRUPT JSON ---------------------------------------------------------------- The elm.json for elm-community/list-extra 2.0.0 got corrupted somehow. I removed it from my file cache, so if it was some transient error it should be fixed if you try the same thing again. Please report this if it seems like an Elm problem though! ```
2019-04-04T12:48:34.427200
Jae
elmlang
general
One thing I noticed is that <https://package.elm-lang.org/packages/mpizenberg/elm-debounce/3.0.2/> exists on the package site but if you search "elm-debounce" it doesn't get listed
2019-04-04T12:49:19.427300
Jae
elmlang
general
That's because that version is not updated for Elm 0.19
2019-04-04T12:49:55.427500
Carman
elmlang
general
I thought 0.18 packages weren't listed at all on the 0.19 package site?
2019-04-04T12:50:47.427800
Jae
elmlang
general
They are excluded from the search results
2019-04-04T12:51:22.428100
Carman
elmlang
general
but if you have a direct link you can still reach it
2019-04-04T12:51:33.428300
Carman
elmlang
general
&gt;&gt;&gt; I do not have the time to update it to elm 0.19 with the modifications I wished in response to issues #5 and #6 (removing functions and state monad, move functionalities to update instead of view). You will probably find what you need with Gizra/elm-debouncer.
2019-04-04T12:51:45.428500
Carman
elmlang
general
from the README
2019-04-04T12:51:49.428700
Carman
elmlang
general
Oops, this whole time I thought there was a separate domain for 0.18 packages
2019-04-04T12:52:30.428900
Jae
elmlang
general
The easiest way to check if a package supports 0.19 is to look it up on GitHub. If it has an `elm.json` then it's 0.19. If it has an `elm-package.json` then it's 0.18 or older
2019-04-04T12:53:23.429300
Carman
elmlang
general
Alright
2019-04-04T12:53:31.429500
Jae
elmlang
general
Should I still open a github issue for the error message though? ```-- CORRUPT JSON ---------------------------------------------------------------- The elm.json for elm-community/list-extra 2.0.0 got corrupted somehow. ...``` is not very helpful!
2019-04-04T12:54:02.429700
Jae
elmlang
general
Is `Debug` the only way to cause a side-effect without a `Cmd`?
2019-04-04T14:34:03.431400
Leoma
elmlang
general
Pretty much.
2019-04-04T14:34:21.431600
Niesha
elmlang
general
perhaps causing a javascript `RangeError` also qualifies
2019-04-04T14:35:45.432200
Virgie
elmlang
general
through unbounded recursion
2019-04-04T14:35:52.432500
Virgie
elmlang
general
No, you can also do the trick with js proxies
2019-04-04T14:37:40.433200
Kris