workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
elmlang | general | thats a weird method... | 2019-05-02T07:09:18.432900 | Isaias |
elmlang | general | elm architecture question: how do you decide whether something is "large enough" for a nested elm architecture? because components are abundant in <https://github.com/rtfeldman/elm-spa-example/blob/master/src/Main.elm> | 2019-05-02T07:24:10.434600 | Isaias |
elmlang | general | its not anything that could be its own app, small stuff belongs lifted up. But its not nothing | 2019-05-02T07:25:28.435900 | Isaias |
elmlang | general | like how do _you_ in particular decide | 2019-05-02T07:26:21.436400 | Isaias |
elmlang | general | best I can think of :smile: it would basically behave as both a number and a function
the magic of js! | 2019-05-02T07:35:00.436500 | Nana |
elmlang | general | my best guess is that the idea is that hierarchially sound applications should be written top-down, and "components" are an excuse to write bottom-up, so unless you take state from the top and move it down, you aren't writing in best practice | 2019-05-02T07:45:00.440000 | Isaias |
elmlang | general | If you are using the SPA example, then I think for me its based around what I want to display to a user at a particular time… i.e. what page are they actually on? | 2019-05-02T07:45:23.440100 | Bud |
elmlang | general | Which is about as “top down” as you can get I believe. | 2019-05-02T07:46:09.440300 | Bud |
elmlang | general | sure, except `Article.Feed` is more like a reusable view than a page | 2019-05-02T07:47:28.440600 | Isaias |
elmlang | general | Totally. Seems like a thing you would want in multiple pages | 2019-05-02T07:48:03.440800 | Bud |
elmlang | general | you only need "components" when you want something that manages private state | 2019-05-02T07:48:33.441000 | Nana |
elmlang | general | <@Nana> i mean, yeah. but how do you know when local state is better is my question | 2019-05-02T07:49:08.441200 | Isaias |
elmlang | general | I think what Feldman recommends is to avoid it when you can, only use it when you have to | 2019-05-02T07:52:09.441500 | Nana |
elmlang | general | for example custom select boxes, date pickers, and pages in an SPA | 2019-05-02T07:52:30.441700 | Nana |
elmlang | general | why are those "have to" cases, arguable you can keep all that state in one place | 2019-05-02T07:53:07.441900 | Isaias |
elmlang | general | well, you could have your pages state be global, if you don't want it to reset when switching pages | 2019-05-02T07:55:29.442100 | Nana |
elmlang | general | but select boxes and date pickers need a lot of logic for updating their state, so you want to have reusable update functions for them | 2019-05-02T07:56:40.442300 | Nana |
elmlang | general | evan would argue otherwise in the life of a file. | 2019-05-02T08:08:41.442500 | Isaias |
elmlang | general | tbh select boxes are particularly something i would write as a controlled component in react | 2019-05-02T08:09:47.442700 | Isaias |
elmlang | general | you mean stateless? | 2019-05-02T08:16:54.443100 | Nana |
elmlang | general | yup thats what they call those in react land | 2019-05-02T08:19:15.443300 | Isaias |
elmlang | general | Tasks are essentially cmds but with the option of failing, right? | 2019-05-02T08:20:16.444100 | Isaias |
elmlang | general | How can `Time.now` fail? | 2019-05-02T08:20:39.444600 | Isaias |
elmlang | general | my select boxes for example have this private state:
```
type alias Model =
{ open : Bool - wether the dropdown is open
, filter : String -- filter results by a string
, index : Int -- for navigating with arrow keys
}
``` | 2019-05-02T08:21:03.444700 | Nana |
elmlang | general | it'd be annoying if I had to rewrite the logic for that every time I wanted a select box | 2019-05-02T08:21:42.444900 | Nana |
elmlang | general | that'd be pretty bad really | 2019-05-02T08:22:50.445200 | Nana |
elmlang | general | yeah that was going to be my next reply :slightly_smiling_face: | 2019-05-02T08:22:52.445400 | Roberta |
elmlang | general | `Time.now` is guaranteed not to fail because it is polymorphic in its error type | 2019-05-02T08:24:07.445600 | Kenya |
elmlang | general | so i ask because im curious why its implemented as a task rather than a command | 2019-05-02T08:25:08.445800 | Isaias |
elmlang | general | Tasks also return a result when they complete while Cmds do not | 2019-05-02T08:25:10.446000 | Kenya |
elmlang | general | Tasks are side effects, commands aren’t | 2019-05-02T08:25:33.446600 | Danika |
elmlang | general | Because it returns a `Time.Posix` and Cmds do not return anything | 2019-05-02T08:25:45.446800 | Kenya |
elmlang | general | ? thats not right <@Danika> | 2019-05-02T08:25:52.447000 | Isaias |
elmlang | general | What commands produce side effects | 2019-05-02T08:26:25.447600 | Danika |
elmlang | general | literally every command | 2019-05-02T08:26:47.447800 | Isaias |
elmlang | general | :thinking_face: why do you think that | 2019-05-02T08:28:03.448200 | Danika |
elmlang | general | why not implement `now` as a function that takes a (Posix -> msg) cand returns a cmd msg that tells update the time | 2019-05-02T08:29:01.448400 | Isaias |
elmlang | general | <@Danika> hb Random | 2019-05-02T08:29:16.448600 | Isaias |
elmlang | general | isn't it more the opposite? :stuck_out_tongue:
Tasks don't produce any effects by themselves, you always have to turn them into Commands and pass them to the runtime | 2019-05-02T08:29:44.449100 | Nana |
elmlang | general | <@Isaias> Oops! Cmds /do/ return something. So I don't know why `Time.now` is a `Task` rather than a `Cmd`. | 2019-05-02T08:29:47.449300 | Kenya |
elmlang | general | Oops. Cmds do return something. So I think your initial statement is right without additions. | 2019-05-02T08:30:59.450200 | Kenya |
elmlang | general | Yeah im on another planet ignore me :joy: | 2019-05-02T08:32:11.450900 | Danika |
elmlang | general | Mentioning random is a good point though, why is that _not_ a task if Time.now is | 2019-05-02T08:32:30.451600 | Danika |
elmlang | general | well it makes sense bc random cant fail | 2019-05-02T08:33:02.451800 | Isaias |
elmlang | general | Tasks can be chained, Commands can't, that's the real difference I think | 2019-05-02T08:34:57.452100 | Nana |
elmlang | general | Task and be sequenced with other Tasks using `Task.andThen`, that's why `Time.now` gives you a Task | 2019-05-02T08:35:37.452300 | Earlean |
elmlang | general | you could have view function `viewSB open view index` | 2019-05-02T08:36:48.452600 | Isaias |
elmlang | general | why isnt random a task? why cant you sequence cmds? | 2019-05-02T08:47:07.452800 | Isaias |
elmlang | general | Hi all I'm experiencing a strange problem in elm 0.19; I'm recompiling a port module which used to work in 0.18; I also checked the documentation to see if something changed but I can't see my error. Here is a stripped version
```
port module FileUpload exposing (FilePortData, fileContentRead2, fileSelected, pippo)
type alias FilePortData =
{ contents : String
, filename : String
, id : String
}
port pippo : (Int -> msg) -> Sub msg
port fileContentRead2 : (FilePortData -> msg) -> Sub msg
port fileSelected : String -> Cmd msg
```
If use the console interactively I can see my app.ports has one port (the outgoing one with a Cmd msg) while the subscription ones are missing
Any idea? | 2019-05-02T08:50:47.455000 | Epifania |
elmlang | general | I think that's part of the "Actor Model" which Elm is based on? | 2019-05-02T08:50:54.455100 | Nana |
elmlang | general | can you explain that further? | 2019-05-02T08:51:32.455300 | Isaias |
elmlang | general | don't know too much about it, but you can just google it | 2019-05-02T08:52:07.455500 | Nana |
elmlang | general | What is the error message you're getting? | 2019-05-02T08:52:12.455700 | Jae |
elmlang | general | I can't find any of the outgoing ports from the javascript side | 2019-05-02T08:52:50.456000 | Epifania |
elmlang | general | Ports get removed if they aren't referenced somewhere in your Elm program | 2019-05-02T08:52:59.456200 | Jae |
elmlang | general | at least one should be... | 2019-05-02T08:53:22.456400 | Epifania |
elmlang | general | the fileContentRead2 is referenced | 2019-05-02T08:53:40.456600 | Epifania |
elmlang | general | I tried to simplify the port signature in case the type alias was creating some issue but the outgoing port is still missing | 2019-05-02T08:58:43.456800 | Epifania |
elmlang | general | Elm 0.19 does function level dead code elimination, any functions that aren't used by something that is used are removed. Check that you're actually using that port from the `subscriptions` function in your `Main.main` | 2019-05-02T09:06:05.457000 | Earlean |
elmlang | general | It might be that the thing referencing fileContentRead2 itself isn't referenced anywhere | 2019-05-02T09:06:38.457200 | Jae |
elmlang | general | You can't sequence Cmds because they're not required to produce a result | 2019-05-02T09:11:00.457500 | Earlean |
elmlang | general | Tasks are required to produce some result | 2019-05-02T09:11:22.457700 | Earlean |
elmlang | general | You folks are right... the point is I was calling a port from the subscription... of a sub-component whose subscription function was not called from the main app | 2019-05-02T09:16:17.457900 | Epifania |
elmlang | general | thank you all | 2019-05-02T09:17:02.458400 | Epifania |
elmlang | general | Not quite - commands don’t guarantee a result | 2019-05-02T10:10:55.458700 | Huong |
elmlang | general | There are examples where you know you will never get a response, like ports and navigation | 2019-05-02T10:13:14.458900 | Huong |
elmlang | general | In elm/http/1 you had
```
Error.BadStatus (Response String)
```
but in elm/http/2 you have
```
Error.BadStatus Int
```
How are you supposed to get hold of the response body with the new API? | 2019-05-02T10:46:15.459400 | Kimbery |
elmlang | general | looks like <https://package.elm-lang.org/packages/elm/http/latest/Http#expectStringResponse> is the best option now | 2019-05-02T10:47:39.459800 | Kimbery |
elmlang | general | <@Kimbery> yup | 2019-05-02T10:48:53.460000 | Nana |
elmlang | general | that does seem cleaner, decoding all potential responses in the same place | 2019-05-02T10:49:32.460600 | Kimbery |
elmlang | general | Was there any discussion about the changes in elm/http2 when it was released? | 2019-05-02T10:50:47.461000 | Kimbery |
elmlang | general | Another option is to use this package <https://package.elm-lang.org/packages/jzxhuang/http-extras/latest/Http-Detailed> | 2019-05-02T10:55:44.461300 | Rosalee |
elmlang | general | is there a function which given two lists it just combines the two by appending every other element from one list and the other? To achieve this, for example
```
list1 = [1, 3, 5]
list2 = [2, 4, 6]
combineLists list1 list2 == [1, 2, 3, 4, 5, 6]
``` | 2019-05-02T10:57:21.462700 | Vilma |
elmlang | general | <@Vilma> `list1 ++ list2` :smile: | 2019-05-02T10:58:02.463100 | Nana |
elmlang | general | Alternatively, `List.map2 (\x y -> [x, y]) list2 list2 |> List.concat` to get them in the order you describe | 2019-05-02T11:02:13.464900 | Huong |
elmlang | general | Oh right missed that :sweat_smile: | 2019-05-02T11:06:23.465500 | Nana |
elmlang | general | `List.Extra.interleave` does that too | 2019-05-02T11:06:52.466400 | Nana |
elmlang | general | Yeah, `interweave` is pretty nice, though behaves slightly differently in that it appends the rest of other list when one of them runs out of options | 2019-05-02T11:08:06.467400 | Huong |
elmlang | general | <@Earnest> <@Isaias> At this point I'm less interested in publishing it than in _generating_ the docs. I can't figure out any tools that will generate a usable HTML docs page in my use case :confused: | 2019-05-02T13:13:13.468700 | Sofia |
elmlang | general | <@Sofia> I missed the earlier parts of the conversation, but have you seen <https://github.com/dmy/elm-doc-preview>? There’s one caveat in the readme
> Note that applications documentation is not yet supported by Elm, so only the README and dependencies are supported for those at the moment. | 2019-05-02T13:30:10.469400 | Alicia |
elmlang | general | Yeah, that's where I got tripped up :disappointed: | 2019-05-02T13:33:42.469600 | Sofia |
elmlang | general | As far as I understand -- my library requires ports to handle certain touch events, so if I make it a `package` then I won't be able to install it. | 2019-05-02T13:34:16.470500 | Sofia |
elmlang | general | Is the way to go here to have another `elm.json` in its directory and point edp at it? | 2019-05-02T13:34:29.471000 | Sofia |
elmlang | general | hmmm that might work, you’re right on the ports code, you wouldn’t be able to publish it to the package repo, I’m not sure if the doc gen tool checks all that or not | 2019-05-02T13:35:00.471600 | Alicia |
elmlang | general | I'll give that a shot | 2019-05-02T13:35:52.471800 | Sofia |
elmlang | general | thanks! | 2019-05-02T13:35:56.472000 | Sofia |
elmlang | general | An option to consider: move the relevant modules into a separate folder as if you were setting up a package. Add a package elm.json with the modules you want docs for in the exposed-modules. Add the directory for that "package" to your application elm.json | 2019-05-02T13:35:59.472100 | Huong |
elmlang | general | I've been wanting to do a thing like that with some of the modules in our application - to enforce docs and separation of concerns | 2019-05-02T13:37:29.472400 | Huong |
elmlang | general | np, I’m interested to know if it works too! it would be nice to generate docs from our application code for new hires and stuff | 2019-05-02T13:41:23.474300 | Alicia |
elmlang | general | I'll give that a shot! Messing around with directories right now -- curious if you have thoughts. Imagine I have a library named `Dandy`, and I want to hide its Internals away.
I've added `lib/Dandy` to the source directories of my application. What's a good spot for the `Internal.elm` file? I assume I want the module name to be `Dandy.Internal`. That would imply a directory structure like:
```
lib
↳ Dandy
↳ elm.json
↳ Dandy.elm
↳ Dandy -- This `Dandy/Dandy` folder gives me the heebie-jeebies
↳ Internal.elm
``` | 2019-05-02T14:26:06.476500 | Sofia |
elmlang | general | I'll admit this is basically only an aesthetic issue entirely. | 2019-05-02T14:26:19.476700 | Sofia |
elmlang | general | Yeah, that's no fun. There's also the thing that a package elm.json requires an src directory. :thinking_face: | 2019-05-02T14:37:00.476900 | Huong |
elmlang | general | So reality would be `lib/dandy/src/Dandy/Internal.elm` :sweat_smile: | 2019-05-02T14:37:47.477100 | Huong |
elmlang | general | Is there a way to add a type annotation to something like this?
```
let
(a, b) = (4, 5)
in
...
``` | 2019-05-02T14:39:53.478100 | Jae |
elmlang | general | ```let
(a, b) : (Int, Int)
(a, b) = (4, 5)
in```
doesn't seem to work | 2019-05-02T14:42:07.478400 | Jae |
elmlang | general | oh _no_ | 2019-05-02T14:45:08.478800 | Sofia |
elmlang | general | hmm, I was thinking this might work, but it doesn’t either
```
(( a, b ) as val) =
( 3, 4 )
```
could you write it as
```
val : (Int, Int)
val = (4,5)
(a, b) = val
```? | 2019-05-02T14:45:35.479000 | Alicia |
elmlang | general | For internal modules that's way overkill, innit. | 2019-05-02T14:45:49.479200 | Sofia |
elmlang | general | I'll let you know if I figure anything out here. | 2019-05-02T14:46:31.479500 | Sofia |
elmlang | general | Yeah, that would work, feels kind of silly to add an extra line in order to deconstruct it though | 2019-05-02T14:46:43.479700 | Jae |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.