workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
elmlang
|
general
|
A `Set a` is basically a `Dict a ()`, so it is really easy to implement using `assoc-list`.
I don't know if someone already published it. If not, publish it if you need it.
|
2019-02-01T18:12:35.744800
|
Velia
|
elmlang
|
general
|
I literally copy/pasted the code for Set from elm/core and replaced all the Set_builtin with the `Set` from `type Set a = Set (Dict a ())` and it's all working? Should / can I post it to elm packages for others?
|
2019-02-01T18:13:57.745000
|
Buffy
|
elmlang
|
general
|
Or just so I don't have to hold onto it in my repo?
|
2019-02-01T18:14:11.745200
|
Buffy
|
elmlang
|
general
|
Or how does that work?
|
2019-02-01T18:14:15.745400
|
Buffy
|
elmlang
|
general
|
I would add at least some notes in the README about the implementation based on `assoc-list` and the resulting performance. Also be sure to replace the `comparable` by `a`, else it's useless. At last the hardest part is finding a good name that can be found when searching a Set, this is the weak point of `assoc-list` in my opinion, it is not easy to find when searching a generic Dict.
|
2019-02-01T18:18:53.745700
|
Velia
|
elmlang
|
general
|
assoc-set?
|
2019-02-01T18:19:21.745900
|
Buffy
|
elmlang
|
general
|
You also have the dual issue of naming like the existing packages that use `key -> comparable` functions to get their 'any-ness'
|
2019-02-01T18:20:10.746200
|
Buffy
|
elmlang
|
general
|
`assoc-set` is both easy to find when searching `set` and `assoc`, it's a good point. However its implementation does not really require an association at all, as the `()` is unused, so it is a little misleading. I don't know.
|
2019-02-01T18:33:44.746600
|
Velia
|
elmlang
|
general
|
That's fair, I'm open to ideas :slightly_smiling_face:
|
2019-02-01T18:34:10.746900
|
Buffy
|
elmlang
|
general
|
awesome-set? sets-are-cool? Hahaha
|
2019-02-01T18:34:29.747200
|
Buffy
|
elmlang
|
general
|
omni-set?
|
2019-02-01T18:34:38.747400
|
Buffy
|
elmlang
|
general
|
set-a
|
2019-02-01T18:34:44.747600
|
Buffy
|
elmlang
|
general
|
I can't think of anything better unfortunately. Your call.
|
2019-02-01T18:34:52.747800
|
Velia
|
elmlang
|
general
|
Well I'll publish and then if people don't like it I can change it :slightly_smiling_face:
|
2019-02-01T18:35:13.748000
|
Buffy
|
elmlang
|
general
|
Haha! I published a package! <https://package.elm-lang.org/packages/erlandsona/assoc-set/latest/>
Okay okay I know I need to go update the docs and everything.
It's my first OS package, ever?!
|
2019-02-01T18:59:39.748300
|
Buffy
|
elmlang
|
general
|
platform.program had no view function. is there an equivalent in 0.19's browser?
|
2019-02-01T21:47:30.750200
|
Rozanne
|
elmlang
|
general
|
<https://package.elm-lang.org/packages/elm/core/latest/Platform#worker>
|
2019-02-01T21:52:07.750400
|
Earlean
|
elmlang
|
general
|
thank you
|
2019-02-01T22:09:38.750600
|
Rozanne
|
elmlang
|
general
|
<@Sau> I had the same issues with elm-format... add the `--unsafe-perms` flag.
|
2019-02-02T00:33:59.751800
|
Erin
|
elmlang
|
general
|
eyy anyone know how Cmd race conditions work, if any?
|
2019-02-02T01:59:46.752300
|
Euna
|
elmlang
|
general
|
like if I have a Nav.load and a Port to save, to localstorage, do they get executed sequentially?
|
2019-02-02T02:00:39.753200
|
Euna
|
elmlang
|
general
|
<@Euna> `Cmd`s in a batch are unordered
|
2019-02-02T02:01:10.753600
|
Earlean
|
elmlang
|
general
|
If you want to order them you need to explicitly order them by going through `update`
|
2019-02-02T02:01:50.754100
|
Earlean
|
elmlang
|
general
|
ie. You have one `Cmd` produce a `Msg` and then have the next `Cmd` returned from the next `update`
|
2019-02-02T02:02:41.754900
|
Earlean
|
elmlang
|
general
|
seen people at fosdem wearing elm shirts :slightly_smiling_face:
|
2019-02-02T04:25:41.755700
|
Desire
|
elmlang
|
general
|
or well one so far
|
2019-02-02T04:25:52.756000
|
Desire
|
elmlang
|
general
|
Question: How can I decode this JSON response from an API
```
query : {
search: {
[
0: { title: "xyz" },
1: {title: "elm"}, // and so on
]
}
```
I am trying `field "query" (field "search")`, but how do I decode a list of objects?
|
2019-02-02T05:47:46.759800
|
Lavada
|
elmlang
|
general
|
Oops should post it in beginners channel
|
2019-02-02T05:48:23.760200
|
Lavada
|
elmlang
|
general
|
<@Lavada> There's `list`: <https://package.elm-lang.org/packages/elm/json/latest/Json-Decode#list>
|
2019-02-02T05:49:56.760900
|
Hoa
|
elmlang
|
general
|
Which decodes a list of "things". Basically you have to provide another decoder for each thing you are going to need
|
2019-02-02T05:50:50.762000
|
Hoa
|
elmlang
|
general
|
Oh how far Elm has come!
|
2019-02-02T07:24:48.762300
|
Danika
|
elmlang
|
general
|
Anyone have any luck manually decoding `target.selectedOption` for select `onChange`?
|
2019-02-02T07:54:46.763300
|
Ema
|
elmlang
|
general
|
```
onSelect : (Maybe ( String, String ) -> msg) -> Attribute msg
onSelect handler =
on "change" (Decode.map handler optionParser)
optionParser : Decode.Decoder (Maybe ( String, String ))
optionParser =
Decode.map
(List.head << Maybe.withDefault [] << Debug.log "option")
(Decode.maybe
(Decode.at [ "target", "selectedOptions" ] (Decode.list optionDecoder))
)
optionDecoder : Decode.Decoder ( String, String )
optionDecoder =
Decode.map2 (\t v -> ( t, v ))
(Decode.field "text" Decode.string)
(Decode.field "value" Decode.string)
```
|
2019-02-02T07:55:09.763600
|
Ema
|
elmlang
|
general
|
something like this - ignore all the maybes - that's just me trying to debug why it doesn't work.
|
2019-02-02T07:55:36.764200
|
Ema
|
elmlang
|
general
|
Is the event elm gives us a faithful representation of the dom event or does it have some different structure?
|
2019-02-02T07:58:08.765000
|
Ema
|
elmlang
|
general
|
It’s the same structure
|
2019-02-02T08:01:05.765900
|
Lea
|
elmlang
|
general
|
So it seems to me that this part :
|
2019-02-02T08:01:41.766600
|
Ema
|
elmlang
|
general
|
```
(Decode.maybe
(<http://Decode.at|Decode.at> [ "target", "selectedOptions" ] (Decode.list optionDecoder))
)
```
|
2019-02-02T08:01:47.766800
|
Ema
|
elmlang
|
general
|
is giving me a `Nothing`
|
2019-02-02T08:01:53.767100
|
Ema
|
elmlang
|
general
|
event if I change the optionDecoder to just spit out some dummy data. So very much appears like target.selectedOptions is the thing it doesn't like
|
2019-02-02T08:02:51.768200
|
Ema
|
elmlang
|
general
|
This is about a `<select>` right?
|
2019-02-02T08:06:52.769300
|
Lea
|
elmlang
|
general
|
correct
|
2019-02-02T08:10:14.770800
|
Ema
|
elmlang
|
general
|
I can see the exact property I'm trying to dig out in the console but it doesn't seem to be coming through in the elm code,
|
2019-02-02T08:10:44.771400
|
Ema
|
elmlang
|
general
|
<https://package.elm-lang.org/packages/elm-community/json-extra/4.0.0/Json-Decode-Extra#collection>
|
2019-02-02T08:10:51.771600
|
Huong
|
elmlang
|
general
|
It's not a real array, so `Decode.list` doesn't like it
|
2019-02-02T08:11:06.772000
|
Huong
|
elmlang
|
general
|
Ah - nasty! Thanks I'll give that a go.
|
2019-02-02T08:11:43.772600
|
Ema
|
elmlang
|
general
|
<https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/selectedOptions> - whenever MDN says it's "a `HTMLCollection` object", it means `Decode.list` won't quite cut it. Silly Web API's :smile:
|
2019-02-02T08:13:33.774000
|
Huong
|
elmlang
|
general
|
Hehehe. Never seen that `collection` before. Nice to know!
|
2019-02-02T08:14:21.775100
|
Hoa
|
elmlang
|
general
|
You can also use `Tuple.pair` for `(\t v -> ( t, v ))` in the `optionDecoder`
|
2019-02-02T08:14:59.775700
|
Lea
|
elmlang
|
general
|
shame I can't just do `(,)` but we won't open _that_ can of worms! Thanks all!
|
2019-02-02T08:15:43.776300
|
Ema
|
elmlang
|
general
|
works a treat. Great.
|
2019-02-02T08:21:10.776500
|
Ema
|
elmlang
|
general
|
Hey folks, could someone clue me in on how to update a package?
|
2019-02-02T09:48:41.777100
|
Rhonda
|
elmlang
|
general
|
I tried by hand and then running elm make, but that tells me to change it back
|
2019-02-02T09:48:55.777200
|
Rhonda
|
elmlang
|
general
|
And when I try elm install it tells me it’s already installed
|
2019-02-02T09:49:05.777400
|
Rhonda
|
elmlang
|
general
|
But it’s not the latest version
|
2019-02-02T09:49:15.777700
|
Rhonda
|
elmlang
|
general
|
Specifically I’m trying to upgrade `elm-graphql`. I’m on `1.1.0` but I see that the latest version is `4.2.0`.
|
2019-02-02T09:52:54.777900
|
Rhonda
|
elmlang
|
general
|
Removing the package from `elm.json` and then re-installing only brings me to `1.3.0`
|
2019-02-02T09:53:19.778100
|
Rhonda
|
elmlang
|
general
|
running `elm install` will install the latest version of a package that is compatible with all the packages currently listed in your elm.json file.
|
2019-02-02T09:55:54.778300
|
Earlean
|
elmlang
|
general
|
Oh I see, so I probably have an incompatible package. I don’t suppose there’s a way to see which one(s)?
|
2019-02-02T09:56:21.778600
|
Rhonda
|
elmlang
|
general
|
the Elm package program doesn't provide this information. But <https://www.markuslaire.com/github/elm-dependencies-analyzer/> is a good way to see this.
|
2019-02-02T09:57:16.778900
|
Earlean
|
elmlang
|
general
|
Thanks!
|
2019-02-02T09:58:16.779100
|
Rhonda
|
elmlang
|
general
|
I wrote an issue about having a blessed style guide (in particular the differing output of `elm-format` and the code in the official guide)- <https://github.com/evancz/guide.elm-lang.org/issues/189> . Any thoughts on it?
|
2019-02-02T10:47:32.780500
|
Luz
|
elmlang
|
general
|
Sounds reasonable to me!
|
2019-02-02T11:04:06.780600
|
Jae
|
elmlang
|
general
|
The previous answer Evan has given about why the core packages didn't follow elm-format was that he intended to start using elm-format once the style of elm-format settled. At the time there was a lot of changes to the elm-format style. But years later that reasoning probably no longer applies.
|
2019-02-02T11:58:51.780800
|
Earlean
|
elmlang
|
general
|
There is a basic style guide that elm-format is based off. <https://elm-lang.org/docs/style-guide>
|
2019-02-02T12:00:31.781000
|
Earlean
|
elmlang
|
general
|
Thanks for the background! I've linked to your comment in the issue <@Earlean>
|
2019-02-02T12:26:58.781300
|
Luz
|
elmlang
|
general
|
has anyone here had use of the fact that `Set` doesn't require a `comparable` type argument all of the time? Like `Set.empty` can be of type `Set Never` or `Set (Maybe Int)`. <https://package.elm-lang.org/packages/elm/core/latest/Set>
|
2019-02-02T16:08:26.783300
|
Saran
|
elmlang
|
general
|
There's no real use to it, it's mostly a stylistic choice to only have it on signatures that require that constraint
|
2019-02-02T16:18:56.783400
|
Huong
|
elmlang
|
general
|
Fair. I accidentally used a non-comparable type when mocking out a module, which is why I asked.
|
2019-02-02T16:20:10.783600
|
Saran
|
elmlang
|
general
|
Is there a way to Benchmark elm code?
|
2019-02-02T18:24:18.784300
|
Margie
|
elmlang
|
general
|
You might want to check my approach with used on “change” for a select. It’s on github/rebelwarrior don’t have a link as I’m on mobile it’s the elm-doc-builder repo the file drop down builder.
|
2019-02-02T18:31:38.787300
|
Margie
|
elmlang
|
general
|
There is this:
<https://package.elm-lang.org/packages/elm-explorations/benchmark/latest/>
|
2019-02-02T18:44:34.787600
|
Velia
|
elmlang
|
general
|
Thank you, I’ve been trying to use it. The examples seem to be old and I haven’t been able to make it work. Have you used it successfully?
|
2019-02-02T20:10:28.789100
|
Margie
|
elmlang
|
general
|
Does anyone have that website handy for searching Elm packages by type? The eq. to Hoogle?
|
2019-02-02T21:05:38.790200
|
Cherryl
|
elmlang
|
general
|
Ah, found it. :slightly_smiling_face: <https://klaftertief.github.io/elm-search/> it’s linked on the package site, doh
|
2019-02-02T21:06:46.790500
|
Cherryl
|
elmlang
|
general
|
I have an error “the function cannot handle the argument …” …
Argument is Foo A B
but the function expects
Foo a b.
This is strange to me, a function that expects a `Foo a b ` can accept a `Foo A B`, no?
I have a feeling the error message is misleading. Has anyone seen this?
|
2019-02-02T23:00:56.792000
|
Leoma
|
elmlang
|
general
|
Was able to get it running by using Benchmark Runner but the documentation wasn’t too helpful.
|
2019-02-02T23:04:45.793400
|
Margie
|
elmlang
|
general
|
<@Leoma> can you show the code? lowercase in type definition says it can accept any type of arguments but it can be false depends on you function body
|
2019-02-02T23:11:21.794800
|
Horace
|
elmlang
|
general
|
for example if you using `A` in place of `a` argument - it definitely can’t be any type, but only `A`.
|
2019-02-02T23:11:55.795400
|
Horace
|
elmlang
|
general
|
I can’t. Too much. I don’t have an SSCCE.
|
2019-02-02T23:12:33.796000
|
Leoma
|
elmlang
|
general
|
But the type variables tell me this message doesn’t make sense. I should be looking elsewhere. I thought someone might have seen similar.
|
2019-02-02T23:13:12.797300
|
Leoma
|
elmlang
|
general
|
So just error maybe?
|
2019-02-02T23:13:18.797500
|
Horace
|
elmlang
|
general
|
Looks like loads of code I’ve written over the past 6 months based on a convention i use. But this time it fails.
|
2019-02-02T23:14:59.799300
|
Leoma
|
elmlang
|
general
|
So it’s really not possible to say anything if you even don’t want to post error from compiler
|
2019-02-02T23:16:20.799500
|
Horace
|
elmlang
|
general
|
Oh sorry! Ya.. I’ll post the error shortly. Away from desk.
|
2019-02-02T23:24:46.800700
|
Leoma
|
elmlang
|
general
|
:thumbsup:
|
2019-02-02T23:38:36.800900
|
Horace
|
elmlang
|
general
|
```
TYPE MISMATCH
This function cannot handle the argument sent through the (|>) pipe:
...
The argument is:
ComponentResult.ComponentResult
BergView.Model
BergView.Msg
BergView.ExternalMsg
err
But (|>) is piping it a function that expects:
ComponentResult.ComponentResult BergView.Model msg externalMsg err
```
|
2019-02-03T00:54:30.801500
|
Leoma
|
elmlang
|
general
|
So… the function expects something more general?! How is that a problem?
|
2019-02-03T00:54:46.801900
|
Leoma
|
elmlang
|
general
|
I mean, it’s most likely I have an issue with my code …. but this error message doesn’t seem helpful, does it?
|
2019-02-03T00:55:57.802600
|
Leoma
|
elmlang
|
general
|
I'll be there this morning. (Sorry for the late notice :P)
|
2019-02-03T01:14:49.802700
|
Sharon
|
elmlang
|
general
|
If could be that `msg` and `externalMsg` are constrained in that context
|
2019-02-03T04:15:55.803800
|
Huong
|
elmlang
|
general
|
<@Leoma> hmm yeah I've seen that too. I was using a function that wanted a "toString" function as an argument, but since my data already was a list of strings, I just passed `identity`
it complained that `identity` was `a -> a`, while it should be `String -> String`
turns out there was an error somewhere else, but somehow it got confused
|
2019-02-03T08:49:03.812100
|
Nana
|
elmlang
|
general
|
Thanks I will take a look. I got it working with the Json.Extra package but I'd be interested in other approaches
|
2019-02-03T11:52:49.812500
|
Ema
|
elmlang
|
general
|
is there V.19 in the wild with support for Effect Managers?
|
2019-02-03T13:13:04.813200
|
Shelli
|
elmlang
|
general
|
wierd type error happening for me
|
2019-02-03T13:39:16.813500
|
Mozella
|
elmlang
|
general
|
```
The 1st argument to `sandbox` is not what I expect:
31| main = Browser.sandbox { init = startingStatus, update = update, view = view }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This argument is a record of type:
{ init : Model, update : Model -> Model, view : Model -> Html Model }
But `sandbox` needs the 1st argument to be:
{ init : Model, update : Model -> Model, view : Model -> Html Model }
```
|
2019-02-03T13:39:20.813700
|
Mozella
|
elmlang
|
general
|
None
|
2019-02-03T13:39:55.814000
|
Mozella
|
elmlang
|
general
|
here is the full file
|
2019-02-03T13:40:03.814500
|
Mozella
|
elmlang
|
general
|
If you only want Html, you can do `main = p [] [ text (DependecyGraph.toString g) ]` - no need to set up a dummy program
|
2019-02-03T13:40:56.815100
|
Huong
|
elmlang
|
general
|
im building from a dummy program to areal one
|
2019-02-03T13:41:13.815800
|
Mozella
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.