workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
I'm seeing the same feedback (maybe it was already in debug mode because I'm in development mode).
2019-02-15T11:19:17.470100
Antonette
elmlang
general
debug should only impact whether `elm` receives the `--debug` flag (enabling the time traveling debugger)
2019-02-15T11:20:12.470300
Huong
elmlang
general
(I've never worked with webpack, so I'm sorry I can't be of more help!)
2019-02-15T11:20:58.470500
Huong
elmlang
general
Wait... arf. Ok. Got it. I needed to reload the webpack server every time I changed the config apparently...
2019-02-15T11:21:00.470700
Antonette
elmlang
general
does anyone write elm in an idiomatic Haskell way?
2019-02-15T11:21:30.471300
Modesto
elmlang
general
trying to use typeclasses?
2019-02-15T11:21:42.471500
Modesto
elmlang
general
Haha
2019-02-15T11:21:49.471600
Huong
elmlang
general
Don't feel bad, I guess I'm paying for my team and my inexperience at the time we started working with Elm.
2019-02-15T11:22:00.471800
Antonette
elmlang
general
Yeah, it doesn't reload that, I've noticed :sweat_smile:
2019-02-15T11:22:04.472000
Huong
elmlang
general
elm does not have typeclasses. Do you mean it the other way around?
2019-02-15T11:22:34.472500
Virgie
elmlang
general
like this packages
2019-02-15T11:22:55.473100
Modesto
elmlang
general
<https://package.elm-lang.org/packages/arowM/elm-monoid/latest/Monoid>
2019-02-15T11:22:56.473300
Modesto
elmlang
general
Well, at least I know why what I was doing didn't seem to have any effect on the results whatsoever :sweat_smile:
2019-02-15T11:23:14.473700
Antonette
elmlang
general
that doesn't really work for the more interesting typeclasses, because in elm a type parameter has to be of kind Type (also written as *)
2019-02-15T11:23:33.474300
Virgie
elmlang
general
Thanks for the serendipitous influence :wink:
2019-02-15T11:24:03.474900
Antonette
elmlang
general
so while that approach works for Monoid, and would for Semigroup, it doesn't work for Monad, Functor, Applicative, Foldable, Traversable, ect.
2019-02-15T11:24:05.475100
Virgie
elmlang
general
Well, you know what it f-ing works!
2019-02-15T11:25:00.476100
Antonette
elmlang
general
because those all take a type parameter `f`, like in `Functor f =&gt; ` then the `f` is applied to another type. Elm does not currently support that
2019-02-15T11:25:05.476400
Virgie
elmlang
general
(at least I can one-require the modules)
2019-02-15T11:25:18.476500
Antonette
elmlang
general
Thanks a bunch for all of that y'all :wink:
2019-02-15T11:25:32.476700
Antonette
elmlang
general
ok
2019-02-15T11:25:48.477100
Modesto
elmlang
general
thank you
2019-02-15T11:25:54.477400
Modesto
elmlang
general
I was planning to make a Complex Numbers package
2019-02-15T11:26:07.477800
Modesto
elmlang
general
and wanted the type to implement Monoid
2019-02-15T11:26:19.478200
Modesto
elmlang
general
off the top of my head I don't know how relavent the other typeclasses are
2019-02-15T11:26:55.479400
Modesto
elmlang
general
monoid for numbers is extra weird because there are two sensible instances. Having an explicit name for both operations will be much nicer I think
2019-02-15T11:27:02.479600
Virgie
elmlang
general
general tip: look at the elm-geometry api. It takes some really abstract concepts and tries to give good names to the operations you might want to do.
2019-02-15T11:27:55.480500
Virgie
elmlang
general
Now the real question is whether a change that should only impact one `main` module will recompile them all or not!
2019-02-15T11:28:43.480600
Huong
elmlang
general
Yep ; and that's what I've started to investigate :wink:
2019-02-15T11:29:13.481100
Antonette
elmlang
general
But already not compiling X times the file is a big deal.
2019-02-15T11:29:36.481500
Antonette
elmlang
general
so the Monoid typeclasses doesn't require a higher kind of type
2019-02-15T11:29:56.481900
Modesto
elmlang
general
thank you for another perspective on it
2019-02-15T11:30:21.482300
Modesto
elmlang
general
hey, wanted to talk/ask about one thing. Recently in my project I encountered rather peculiar situation. We had a model for the user that may have the role and permissions against resources. You know, sth along `role: "admin", permissions: []`. So the domain of the problem suggested that admin does not need to have any permissions because he can do anything he likes while user can have certain permissions. That's why I modeled the user along this: ``` type alias User = {name: String, permissions: Permissions} type Permissions = AdminPerm | UserPerm (Dict Key Permission) ``` don't mind the argument for UserPerm. The point is that I discarded the `role` from the data model in favor of union type with permissions. I wanted to avoid a danger that someone sets the permissions for the admin, which was not suppose to be possible in the light of requirements. One problem down, another pops up. In view I gotta support changing the user role as well as changing permissions. For the ease of my mind, for now, I had created `type Role = Admin | User` which are only possible to be created manually in the view or derived from existing `User` with a function. However I still feel like I am lacking sth or doing one thing in two places even though you cannot use `Role` directly in the User record. My question, therefore, is perhaps not related to Elm strictly, more to data modeling with types which, as far as I can tell, is encouraged in Elm. I am just trying to get ahold of some ideas I might have missed. Wonder if someone had to model user related models in quite a safe way to avoid any weird modifications or states a user can end up. My goal is to make it somehow harder to operate on volatile data behind User model.
2019-02-15T11:56:22.489300
Floy
elmlang
general
I'm putting thread here, in case someone wants to share some experiences :slightly_smiling_face:
2019-02-15T11:57:57.489600
Floy
elmlang
general
and as usual, thank you for any feedback :+1:
2019-02-15T11:59:56.489900
Floy
elmlang
general
I'm more used to seeing permissions assigned to roles, and then roles to users who get the union of permissions of their roles. Is there a reason an entity needs both?
2019-02-15T12:05:43.490100
Dede
elmlang
general
E.g. I'm used to seeing more like this: ```type Permission = Create | Read | ...; type Role = Role { name: String, permissions: List Permission}; type User = User {name: String, roles: List Role}; ```
2019-02-15T12:07:02.490300
Dede
elmlang
general
You can put Resource in at the Permission or Role level, if you need per-resource control.
2019-02-15T12:07:56.490500
Dede
elmlang
general
I think it's not that uncommon to have a system with just permissions and no roles, except an Admin Boolean
2019-02-15T12:12:44.491500
Nana
elmlang
general
I'd probably model it like this: ``` type alias User = {name: String, role: Role} type Role = Admin | NonAdmin (Dict Key Permission) ```
2019-02-15T12:14:11.491700
Nana
elmlang
general
Yeah, that's also perfectly reasonable. It's just seems unusual to me to try to have both.
2019-02-15T12:17:15.492300
Dede
elmlang
general
But maybe I misunderstood the original intent.
2019-02-15T12:17:22.492500
Dede
elmlang
general
our case defines two roles (admin, user (non admin)) where regular users may have defined permissions (READ, WRITE, DELETE) against resources of specific type identified via ID
2019-02-15T12:27:21.492700
Floy
elmlang
general
are there any good examples for using the config pipeline pattern? especially with configs that have multiple mutually exclusive options?
2019-02-15T12:36:05.493700
Emilee
elmlang
general
```type Permission = Read | Write | Delete type Resource = ... type Role = AdminRole | UserRole { permissions: List Permission, resources: List Resource} type User = User { name: String, role: Role} ```
2019-02-15T12:37:06.493800
Dede
elmlang
general
<@Dede> that wouldn't allow a user to have different permissions for different resources though
2019-02-15T12:38:21.494000
Nana
elmlang
general
Sure. I read <@Floy> as asking for this structure.
2019-02-15T12:38:41.494200
Dede
elmlang
general
If it's per-resource, then it's a minor change:
2019-02-15T12:38:49.494400
Dede
elmlang
general
```type ResourceAuth = ResourceAuth Resource (List Permission) tuple Role = AdminRole | UserRole {auths: List ResourceAuth} ```
2019-02-15T12:40:14.494600
Dede
elmlang
general
You could use a record with named fields for ResourceAuth.
2019-02-15T12:40:37.494800
Dede
elmlang
general
You could replace Lists with a set implementation that can handle these types (they're not comparable so stock `set` won't do it.)
2019-02-15T12:40:52.495000
Dede
elmlang
general
etc.
2019-02-15T12:40:56.495200
Dede
elmlang
general
we've been using `Dict.Any` library and actually filled in quite nice
2019-02-15T12:47:31.496400
Floy
elmlang
general
`Nothing` returned from there mean for us that user has no permissions against the resource
2019-02-15T12:47:46.496600
Floy
elmlang
general
which is quite nice to have by default
2019-02-15T12:47:53.496800
Floy
elmlang
general
anyway, you're both recommending to actually play around with renaming but also to keep just one type that suggest if user is an admin or not
2019-02-15T12:48:31.497000
Floy
elmlang
general
that's quite ok, unless I have to change the user role in the view
2019-02-15T12:49:16.497200
Floy
elmlang
general
while it works nice for the admin, for user it requires me to create an empty dict inside the view and pass it along the update's msg
2019-02-15T12:49:41.497400
Floy
elmlang
general
or to have a auxilary type, pure view related, to handle that
2019-02-15T12:49:51.497600
Floy
elmlang
general
unless, maybe I can write down changing the role as sort of a toggle, therefore I don't have to pass permissions inside the update's msg, I just change the role to the opposite one
2019-02-15T12:50:49.497800
Floy
elmlang
general
that sort of makes sense I guess
2019-02-15T12:51:03.498000
Floy
elmlang
general
does it? <@Dede> <@Nana>?
2019-02-15T12:51:19.498200
Floy
elmlang
general
`UserRole` requires the additional data of what are the resources and what are the permissions.
2019-02-15T12:55:05.498400
Dede
elmlang
general
Presumably you have a bunch of checkboxes or something onscreen that provide that info.
2019-02-15T12:55:18.498600
Dede
elmlang
general
Anyhow, however you're denoting it, it's ultimately on your model.
2019-02-15T12:55:38.498800
Dede
elmlang
general
So when you go from AdminRole -&gt; UserRole, you just send a small message from view, and then in your update bit handling the message, you look at the model to pick off the matrix of permissions and resources.
2019-02-15T12:56:10.499000
Dede
elmlang
general
`view = ... button [onClick = SetUserRoleClicked]`
2019-02-15T12:56:33.499200
Dede
elmlang
general
`update = ... case SetUserRoleClicked -&gt; ({model | user = {model.user | role = UserRole (computePermissionsFromModel model)...`
2019-02-15T12:57:19.499400
Dede
elmlang
general
ok, guess I will have to make another go on that
2019-02-15T13:04:43.499600
Floy
elmlang
general
thanks for time that you spent with me :+1:
2019-02-15T13:04:58.499800
Floy
elmlang
general
Hi all! I'm having a problem with the newUrl function in the deprecated Navigation module. I need to navigate to an external url and it doesn't work. I tried the sample from <https://github.com/sircharleswatson/elm-navigation-example> which is perfectly working, changed the url parameter of the newUrl function to "<http://google.com>" in the update.elm file and the links are now not working. What am I doing wrong?
2019-02-15T14:02:12.504700
Zaida
elmlang
general
Yes, I have package `elm-tar`. Does tar without compression. There are two functions, `createArchive` and `extractArchive`. There is a bug in the latter which hope to have fixed in the next day or two. (It sometimes leaves trailing null bytes_.
2019-02-15T21:10:53.505800
Jana
elmlang
general
Hi all, is there an editable tree view library available in Elm on Github? I mean a way to add or delete nodes to a tree via UI.
2019-02-16T03:57:17.506200
Stormy
elmlang
general
Hi all, a question about `Browser.Event.on` As we are living in the virtual dom, creating a load event is not possible. Am I right? I have this custom event: ``` onLoad : msg -&gt; Attribute msg onLoad message = on "load" (Decode.succeed message) ``` and run it in my renderer: ``` section [ class "hscroller" , onLoad (Init identifier) ] ``` and have properly set up the message in my update function. But the message is not send… so: Am I’m doing something wrong, or not possible at all
2019-02-16T04:52:48.509800
Cathey
elmlang
general
Not all elements dispatch the onload event <https://www.w3schools.com/jsref/event_onload.asp>
2019-02-16T04:54:02.509900
Lea
elmlang
general
These do `&lt;body&gt;, &lt;frame&gt;, &lt;iframe&gt;, &lt;img&gt;, &lt;input type="image"&gt;, &lt;link&gt;, &lt;script&gt;, &lt;style&gt;`
2019-02-16T04:54:16.510200
Lea
elmlang
general
oh! crazy… had a look in the MDN documentation and they said: Element… so did not know. that. Thanks for the hint!
2019-02-16T04:55:18.510400
Cathey
elmlang
general
yeah, it only works on element for which 'load' is meaningful. ie. an img tag can load it's src image.
2019-02-16T04:56:39.510800
Earlean
elmlang
general
`&lt;section&gt;` has nothing to load
2019-02-16T04:56:50.511000
Earlean
elmlang
general
hmm… ok then. Well I probably have a more archittectural problem. I want to do some initializationo stuff during runtim of my app. So not on launch. Because the initialization stuff triggers some Dom.getViewportOf, which can only be determined, when it exists…
2019-02-16T05:00:40.511200
Cathey
elmlang
general
You can do that in `init`, the functions in `Browser.Dom` will wait for the next animation frame
2019-02-16T05:04:16.511400
Earlean
elmlang
general
You mean `Browser.application.init`?
2019-02-16T05:06:48.511600
Cathey
elmlang
general
It not possible to do it there, as this is only triggered once on app launnch… i thought…:thinking_face:
2019-02-16T05:07:50.511900
Cathey
elmlang
general
yes, it is.
2019-02-16T05:08:13.512200
Earlean
elmlang
general
if you're not doing it at initialisation then you're doing it in `update`
2019-02-16T05:08:33.512400
Earlean
elmlang
general
yes. I would do it in my update function. But I need a Msg to trigger that update function, right?
2019-02-16T05:09:46.512600
Cathey
elmlang
general
yep, but you need a `Msg` to `update` for the `view` to change at all
2019-02-16T05:10:37.512800
Earlean
elmlang
general
So as soon as it’s rendered, it should throw a message to do stuff …
2019-02-16T05:10:51.513000
Cathey
elmlang
general
since the `view` only represents the `model` and you can't change the `model` except in response to some event
2019-02-16T05:11:06.513200
Earlean
elmlang
general
before any element is rendered in the `view` there was an event that updated to `model` to a state that would result in that element being rendered in the `view`, that is when you do it.
2019-02-16T05:12:15.513400
Earlean
elmlang
general
exactly. So I need an event first. And I thought the `load`would do it, but that is not triggered according to the specs…
2019-02-16T05:12:26.513600
Cathey
elmlang
general
I can make a port and subscribe to that… but thats some kind of ugly…
2019-02-16T05:13:21.513900
Cathey
elmlang
general
what `model` change results in you displaying that `section` element?
2019-02-16T05:13:51.514200
Earlean
elmlang
general
what event results in the `model` being in that state?
2019-02-16T05:14:38.514400
Earlean
elmlang
general
``` Init id -&gt; let _ = Debug.log "initialized hScroller" id in ( hScroller , Cmd.batch [ Random.generate NewRandom (<http://Random.int|Random.int> 0 2) , Dom.getViewportOf id |&gt; Task.andThen (\_ -&gt; setViewportToX id hScroller.viewport.viewport.x) |&gt; Task.attempt (\_ -&gt; NoOp) ] ) ```
2019-02-16T05:14:42.514600
Cathey
elmlang
general
there are no `model` changes there
2019-02-16T05:15:25.514800
Earlean
elmlang
general
I basically want to check the size of the section. with CMD
2019-02-16T05:15:38.515000
Cathey
elmlang
general
in response to what?
2019-02-16T05:15:56.515200
Earlean
elmlang
general
so no model update. I have to trigger some Cmd’s first, and those responses will update my model then…
2019-02-16T05:16:06.515400
Cathey
elmlang
general
Yes that’s the problem. It should be the response of “that the sectino is now rendered and availlable”…
2019-02-16T05:17:27.515600
Cathey