workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
elmlang | general | One question, out of curiosity: is it important that `numbersSoFar` is a record with one member, a property `ns` ? | 2019-01-15T08:36:59.373300 | Santina |
elmlang | general | Absolutely not. It was a bit early in the morning and I just copied the code from my project where it was three fields | 2019-01-15T08:39:35.373500 | Lynne |
elmlang | general | In fact you could do conversion to `Index` in the `parseStep` function prior to returning `Done` | 2019-01-15T08:40:22.373700 | Lynne |
elmlang | general | So you would return `Parser (Step (List Int) Index)` from `parseStep`. Might be a good learning thing for you to try it actually :wink: | 2019-01-15T08:41:28.374000 | Lynne |
elmlang | general | ah that is a super interesting idea | 2019-01-15T09:56:54.374300 | Santina |
elmlang | general | thanks a bunch! | 2019-01-15T09:56:55.374500 | Santina |
elmlang | general | Hello. I was looking for a package to add same basic charts to an app. Is there a lib to create at least pie and histograms? | 2019-01-15T10:59:06.376200 | Allyn |
elmlang | general | <https://code.gampleman.eu/elm-visualization/> might be what you’re looking for | 2019-01-15T11:06:11.376500 | Timika |
elmlang | general | If you just want simple line charts then I can recommend <https://github.com/terezka/line-charts> | 2019-01-15T11:07:00.377200 | Agustin |
elmlang | general | Design pattern question:
Suppose I have an app with several “Page”s which are essentially different views/ui’s for a shared set of data.
Part of each Page is a search field, and that value should be shared among these Pages.
1. Solution: each Page has a search field, and navigations between pages transfer the search value.
Problem: if we jump to a non-search Page, then back, we lose the search
2. Solution: search value is stored in the top-level model, and not the pages.
Problem: Page search update -> dispatching an external message to parent -> parent getting a search value and setting in, then calling the page’s update with the new search value.
This is very “circular” and a bit confusing. There is nothing in the type system to enforce notifying the child during parent’s update (i.e. the parent sets its search field and forgets to do the work of notifying child components if they are interested.)
3. Solution: search value is part of a type that every page must be able to store.
Therefore, a Page can maintain it’s own search value, and the Main update can transfer the value between pages.
Problem: why does my Login page have a search value?!
4. Solution: our top-level model looks like:
{ ...
page : PageModel
...
}
type PageModel =
| Page1Model Page1.Model Page1Leftovers
| Page2Model Page2.Model Page2Leftovers
...
where we are guaranteed to have:
searchValue : PageModel -> String
such that, if the PageX.Model is interested, it stores the search. If not, we store it in the “leftovers”.
Problem: ??? Is there a problem? | 2019-01-15T11:17:01.378300 | Leoma |
elmlang | general | <@Leoma> you could store the search value in the page and the top-level model and pass it in to pages and take it out of pages on navigation. | 2019-01-15T11:25:44.379400 | Earlean |
elmlang | general | that's essentially option 2 but only on navigation | 2019-01-15T11:27:31.380200 | Earlean |
elmlang | general | thank you, that's perfect! | 2019-01-15T11:29:06.380300 | Allyn |
elmlang | general | The thing I like about 4, is that when our top-level update gets a `SearchUpdated search` it has do to something with it. And if our top-level model has a `search : String` it’s easy to set it and think the work is over. Whereas if our top level model doesn’t have an explicit search field, we’re reminded by the type system that we have to figure out where it goes: the interested page, or in the leftover storage. However, this (seems at the moment) more complicated than it should be. | 2019-01-15T11:35:41.383500 | Leoma |
elmlang | general | Among the ones you listed, I would fight for 1. The problem is only that somes pages contain data they dont use. Seems perfectly fine to me. Theres nothing wrong with persisting data you dont use but expect to use later. Mostly importantly tho, its the simplest. Aside from imports and extracting/injecting this value, I think the impact on your case base could be merely one line:
```
, search : SearchModel
```
I dont see the other solutions as coming close in terms of simplicity. | 2019-01-15T11:51:00.387800 | Ashton |
elmlang | general | Right, so I think that’s 3… ? | 2019-01-15T11:52:24.388600 | Leoma |
elmlang | general | I do agree, that this is simplest. Maybe simplicity wins over “correctness” here. | 2019-01-15T11:52:52.389100 | Leoma |
elmlang | general | Regarding 4, what if you have three pages? Do you need `LeftOvers` types for every page it could have come from? | 2019-01-15T11:52:56.389300 | Ashton |
elmlang | general | So I think I’d create a toplevel function
`searchValue : PageModel -> String`.
And also, have each Page only store what it needs.
Then, the toplevel module is forced to figure out how to store the extra data to be able to satisfy the implementation of `searchValue`.
I like this mainly because I’m using the type system to enforce “things store only what they need, and but we must still store all the things” | 2019-01-15T11:55:08.389400 | Leoma |
elmlang | general | There's also elm-vegalite - <https://package.elm-lang.org/packages/gicentre/elm-vegalite/latest/>
For example, here's the code to create a frequency histogram from some raw data:
```
bar2 : Spec
bar2 =
let
enc =
encoding
<< position X [ pName "IMDB_Rating", pMType Quantitative, pBin [] ]
<< position Y [ pMType Quantitative, pAggregate opCount ]
in
toVegaLite
[ dataFromUrl "<https://vega.github.io/vega-lite/data/movies.json>" []
, bar []
, enc []
]
``` | 2019-01-15T12:46:56.389600 | Tynisha |
elmlang | general | Is there a way to install test dependencies with `elm install` or some other tool? | 2019-01-15T16:00:15.390500 | Jae |
elmlang | general | elm-test install | 2019-01-15T16:31:51.390800 | Bert |
elmlang | general | <https://www.npmjs.com/package/elm-test> | 2019-01-15T16:32:12.391000 | Bert |
elmlang | general | Any idea what's going on here?
```The elm.json for elm-community/list-extra 2.0.0 got corrupted somehow.```
Happens on every attempt of `elm install hercules-ci/elm-dropdown`. I've tried `rm -fr elm-stuff ~/.elm`, still happens. | 2019-01-15T16:51:17.391800 | Shelia |
elmlang | general | list-extra is at version 8.1.0, 2.0.0 is probably not even for 0.19 | 2019-01-15T16:52:16.392200 | Virgie |
elmlang | general | any idea how that dependency gets pulled in? | 2019-01-15T16:52:30.392500 | Virgie |
elmlang | general | We have a dependency in `elm.json` for `8.0.0` | 2019-01-15T16:52:48.392800 | Shelia |
elmlang | general | So not sure what's going on with that 2.0.0 | 2019-01-15T16:53:17.393100 | Shelia |
elmlang | general | I think it might be this: <https://github.com/hercules-ci/elm-dropdown/blob/1.0.0/elm.json#L15> | 2019-01-15T16:55:15.394700 | Shelia |
elmlang | general | <@Zachary> :arrow_up: | 2019-01-15T16:55:24.395100 | Shelia |
elmlang | general | what you can try is removing all dependencies, and then adding them again from the command line | 2019-01-15T16:56:15.396300 | Virgie |
elmlang | general | Hmm, maybe not, `elm-community/json-extra` 3.0.0 still works on 0.19 and has no `list-extra` dependency... | 2019-01-15T16:56:19.396600 | Shelia |
elmlang | general | Just to be sure, the `elm` you are calling is the 0.19 binary? | 2019-01-15T16:56:20.396700 | Bert |
elmlang | general | <@Bert> yea, `elm --version` reports 0.19 | 2019-01-15T16:56:35.397100 | Shelia |
elmlang | general | Okay good, keep on debugging! :) | 2019-01-15T16:57:02.397800 | Bert |
elmlang | general | Someone hit this before and apparently had to upgrade there `NoRedInk/elm-json-decode-pipeline`, I will try that (we do depend on that) | 2019-01-15T16:57:26.398300 | Shelia |
elmlang | general | Bah, no, that's up to date. | 2019-01-15T16:57:45.398600 | Shelia |
elmlang | general | I would try what Folkert mentioned above: remove all deps from elm.json and then install again on the terminal | 2019-01-15T17:00:00.400700 | Bert |
elmlang | general | Possibly also removing the cache dir in between | 2019-01-15T17:00:34.401800 | Bert |
elmlang | general | Ok, removing ` "elm-community/list-extra": "8.0.0"` at least lets `elm install` continue | 2019-01-15T17:00:42.402100 | Shelia |
elmlang | general | I'll try continuing with that and see what happens | 2019-01-15T17:00:47.402400 | Shelia |
elmlang | general | that is, removing that line from my `"direct"` `"dependencies"` | 2019-01-15T17:01:12.402900 | Shelia |
elmlang | general | Yea, that worked. Then re-adding `elm-community/list-extra` also worked. :shrug: | 2019-01-15T17:02:30.403300 | Shelia |
elmlang | general | Well good. Could have been a strange dep range condition with maybe an incorrect error message | 2019-01-15T17:04:38.405300 | Bert |
elmlang | general | <@Zachary> I don't think that was necessarily my problem, but I do need `json-extra` 4.0.0 anyway, so I can't use your library until you bump that | 2019-01-15T17:07:25.405900 | Shelia |
elmlang | general | <@Shelia> try 1.0.1 | 2019-01-15T17:10:42.406200 | Zachary |
elmlang | general | Nice, that works with my old `elm.json` too - so the above error must have somehow come from that | 2019-01-15T17:13:23.406700 | Shelia |
elmlang | general | <@Zachary> works perfectly, thanks :tada: | 2019-01-15T17:13:54.407100 | Shelia |
elmlang | general | well thank you :slightly_smiling_face: | 2019-01-15T17:14:02.407300 | Zachary |
elmlang | general | thank us, how about that? | 2019-01-15T17:14:27.407500 | Shelia |
elmlang | general | Hello, as you can see my name is Luka and I'm new here. Like all of you (probably), I too believe that Elm is a "Delightful" language, so I would really like to contribute some work. I was wondering, whether basic data structures like Set, Stack, Queue are already implemented in Elm... If not, is there a reason why? Maybe any other idea how i could contribute? | 2019-01-15T18:04:56.407800 | Lucia |
elmlang | general | Thanks in advance for your answers :wink: | 2019-01-15T18:05:09.408200 | Lucia |
elmlang | general | Welcome to the community <@Lucia> :wave:
Set is in core
The others I haven't used but there are likely existing packages which cover their functionality: <https://package.elm-lang.org/> | 2019-01-15T18:09:03.409600 | Ruthann |
elmlang | general | `Set` is in core, and `Stack` is as well (our `List` is a linked-list, which behaves exactly like a stack). | 2019-01-15T18:12:06.412300 | Virgie |
elmlang | general | Thanks.. Yep, i did a little more research and found out the same. :slightly_smiling_face: I guess I'll have to find something else :smile: | 2019-01-15T18:12:23.412900 | Lucia |
elmlang | general | I think there are some queues. Note that elm is a functional language, and its purity make implementing datastructures less straightforward | 2019-01-15T18:12:54.413400 | Virgie |
elmlang | general | a LIFO is trivial with a linked list | 2019-01-15T18:15:46.414400 | Ruthann |
elmlang | general | a FILO is trivial if it allows 2n space to store the reverse as well | 2019-01-15T18:16:07.414900 | Ruthann |
elmlang | general | getting the performance/space consumption that imperative languages achieve can be a challenge | 2019-01-15T18:17:03.415400 | Virgie |
elmlang | general | on the other hand, in a future where elm runs on a platform with multiple threads, our data structures are thread safe by default | 2019-01-15T18:17:37.416000 | Virgie |
elmlang | general | As to where you can contribute: is there anything you are particularly interested in actually doing? | 2019-01-15T18:18:48.417000 | Virgie |
elmlang | general | I'm not really sure :smile: I'm a student, i had a subject, where we were programming in Elm and it was really interesting. I would really like to continue upgrading my knowledge in functional programming. | 2019-01-15T18:21:02.419200 | Lucia |
elmlang | general | well picking a subject you like can really help. For instance I've always liked projects with some visual output. | 2019-01-15T18:22:33.420300 | Virgie |
elmlang | general | and in that case I think it would be really valuable for some package authors to have a novice work with their package, documenting difficulties and implementing something fun | 2019-01-15T18:23:29.421200 | Virgie |
elmlang | general | Okay, great I'll look into that first, maybe i find something interesting and easy enough for me. :wink: | 2019-01-15T18:25:30.422300 | Lucia |
elmlang | general | there is one of those quotes at the slack startup saying roughly "not all contributions are code", in fact most contributions are/should not be in code | 2019-01-15T18:26:30.423500 | Virgie |
elmlang | general | and a newcomer's perspective is very valuable | 2019-01-15T18:27:18.423900 | Virgie |
elmlang | general | That's interesting. Well to be honest, I'm also new at Slack and the whole concept of open-source projects, so I didn't really know where to start. Anyway, thanks for giving me first tips :smile: I'll probably find something, or maybe even start some new project. We'll see... | 2019-01-15T18:32:23.428700 | Lucia |
elmlang | general | hello, looking forward to get in touch with Elm closely, but faced one issue.
My plan is not to write views in the beginning but instead simply output model as-is using Microsoft/elm-json-tree-view
But the issue here that I can't output model (record) as a JSON to Decode it afterwards
Json.Encode also requires List (String, a) for encoding to JSON
Anyone know how to Encode a record or I'm missing something obvious? | 2019-01-15T19:14:54.432300 | Fay |
elmlang | general | records are encoded as a collection of fields | 2019-01-15T19:16:54.432600 | Virgie |
elmlang | general | for instance the example here <https://package.elm-lang.org/packages/elm/json/latest/> encodes the `Cause` record | 2019-01-15T19:17:26.433000 | Virgie |
elmlang | general | <@Virgie> great
but what if I don't know the structure?
would be a little overkill to describe the whole model for encoding
for instance elm-json-tree-view produces Html msg on any form
my idea to use the same for model
Model -> ... -> Html msg | 2019-01-15T19:20:40.435700 | Fay |
elmlang | general | I think the only generic way is to use `Debug.toString` on the model, then `Html.text` on that string | 2019-01-15T19:23:49.436200 | Virgie |
elmlang | general | normally you'd be able to use the debugger to inspect the model without actually drawing anything, but the debugger is not reliable in 0.19 so far | 2019-01-15T19:24:24.437300 | Virgie |
elmlang | general | <@Virgie> that was the case for me, the only issue is that it prints model different
```{ content = { text = "Example" } }```
instead of JSON form
```{ "content": { "text": "Example" } }``` | 2019-01-15T19:25:48.438900 | Fay |
elmlang | general | to I guess I need to make some regex work | 2019-01-15T19:26:17.439400 | Fay |
elmlang | general | why do you want to display json strings? | 2019-01-15T19:26:35.439800 | Virgie |
elmlang | general | I don't
I need Model to be usable to generate view by elm-json-tree-view | 2019-01-15T19:27:25.440900 | Fay |
elmlang | general | because in essence there is no "free" way to turn an elm object into json. You have to write an encoder | 2019-01-15T19:27:32.441300 | Virgie |
elmlang | general | I understand | 2019-01-15T19:27:55.441600 | Fay |
elmlang | general | even so
i guess encoder will require explicit field names etc. | 2019-01-15T19:28:27.442300 | Fay |
elmlang | general | yes | 2019-01-15T19:29:29.442900 | Virgie |
elmlang | general | which is not my case | 2019-01-15T19:30:11.443800 | Fay |
elmlang | general | so while a tree-like view would be very nice, and will be possible once the debugger works reliably, for now I prefer Debug.log and Debug.toString | 2019-01-15T19:30:25.444400 | Virgie |
elmlang | general | yep | 2019-01-15T19:30:37.444600 | Fay |
elmlang | general | the reason I was asking here
it sounds so weird not to have iterator for record fields that it made me stuck ) | 2019-01-15T19:31:31.445500 | Fay |
elmlang | general | one more question
is there any Elm source code that I can fork and play around? | 2019-01-15T19:34:28.446100 | Fay |
elmlang | general | I found none | 2019-01-15T19:34:37.446300 | Fay |
elmlang | general | for the compiler, or just an application written in elm? | 2019-01-15T19:35:47.446600 | Virgie |
elmlang | general | <https://github.com/search?q=language%3AElm> | 2019-01-15T19:37:23.446800 | Earnest |
elmlang | general | Is it not possible to make a port with no arguments? `port somePort : () -> Cmd msg` compilers but `somePort` doesn't show up in `app.ports` in JS side | 2019-01-15T19:46:27.447900 | Lesli |
elmlang | general | your port has to be used (in elm) to be visible | 2019-01-15T19:47:31.448300 | Virgie |
elmlang | general | if it's not used the dead code elimination will remove it | 2019-01-15T19:47:42.448700 | Virgie |
elmlang | general | Ugh that sounds like it, thanks <@Virgie> :slightly_smiling_face: | 2019-01-15T19:48:12.449200 | Lesli |
elmlang | general | This has become the most asked question about ports since 0.19 came out... | 2019-01-15T19:48:21.449300 | Earnest |
elmlang | general | yea, 0.19 has some issues that I really would like to see fixed in a 0.19.1 release | 2019-01-15T19:53:19.449600 | Virgie |
elmlang | general | :coffee: | 2019-01-15T20:06:17.450900 | Earlean |
elmlang | general | Has anyone heard of Angular’s upcoming _Incremental DOM_? I wonder if the same approach will make sense in Elm. <https://blog.nrwl.io/understanding-angular-ivy-incremental-dom-and-virtual-dom-243be844bf36> | 2019-01-15T20:20:48.451700 | Jenni |
elmlang | general | It appears to require a domain specific language that then compiles to the incremental DOM code. Which mean that you couldn't use Elm to describe your views, you'd use some other limited domain specific language. You certainly get speed, but you loose a large amount of developer ergonomics. | 2019-01-15T20:38:36.455800 | Earlean |
elmlang | general | Actually the port is being called.. | 2019-01-15T21:23:49.457600 | Lesli |
Subsets and Splits