workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
elmlang | general | Interesting approach. | 2019-03-19T14:23:06.408600 | Rosaria |
elmlang | general | that was the advice for routing in Meteor, which I've followed since | 2019-03-19T14:28:51.408800 | Nana |
elmlang | general | I'll consider that. Thanks :smile: | 2019-03-19T14:30:21.409000 | Rosaria |
elmlang | general | Ah, although there is a problem with that. We don't duplicate our authentication logic on the client side. | 2019-03-19T14:32:18.409200 | Rosaria |
elmlang | general | We just let the server throw 401s back at us when the user needs to be authed and so we know. | 2019-03-19T14:32:40.409400 | Rosaria |
elmlang | general | Will have to look at other workarounds :disappointed: | 2019-03-19T14:32:45.409600 | Rosaria |
elmlang | general | Is it possible to perform a Task ignoring failure cases? | 2019-03-19T15:23:11.410000 | Marlys |
elmlang | general | performing a task must fire a message, but you can ignore that message | 2019-03-19T15:25:03.410400 | Virgie |
elmlang | general | but I don't think a `Task SomeError a -> Task Never a` exists | 2019-03-19T15:25:29.411000 | Virgie |
elmlang | general | Hmm ok | 2019-03-19T15:25:38.411200 | Marlys |
elmlang | general | You can | 2019-03-19T15:26:10.411400 | Kris |
elmlang | general | Use `mapError boom` to get a `Task Never something` and then use perform | 2019-03-19T15:26:55.412600 | Kris |
elmlang | general | `boom x = boom x` | 2019-03-19T15:27:06.413000 | Kris |
elmlang | general | It crashes your app if the task fails though | 2019-03-19T15:27:56.413500 | Kris |
elmlang | general | yea, that's not what I want :smile: | 2019-03-19T15:28:07.413800 | Marlys |
elmlang | general | Thought: keep an `epoch` number in your model. You increment it whenever something happens that invalidates outstanding messages, e.g. a completed redirect. You embed it in every message associated with an outstanding request. When you receive a completed request response if the embedded epoch doesn’t match `model.epoch` you don’t act on it. It’s easier than putting a UID on every outstanding request and less subject to weird races. | 2019-03-19T15:31:28.413900 | Dede |
elmlang | general | Also an interesting suggestion. | 2019-03-19T15:37:48.414100 | Rosaria |
elmlang | general | I'll consider that a bit more, thanks for your efforts guys. | 2019-03-19T15:37:56.414300 | Rosaria |
elmlang | general | should bad error messages be reported in the issue tracker? if yes, where? | 2019-03-19T15:59:59.415000 | Mary |
elmlang | general | <https://github.com/elm/error-message-catalog> | 2019-03-19T16:00:28.415300 | Kris |
elmlang | general | Done :slightly_smiling_face: <https://github.com/elm/error-message-catalog/issues/291> | 2019-03-19T16:17:13.415900 | Mary |
elmlang | general | (Ping <@Cristie> as author of the line-charts library, not sure if the API design could have an influence with regard to error messages) | 2019-03-19T16:17:49.416100 | Mary |
elmlang | general | Could you pick a single api request to send on init and just sit there waiting for it to come back? If it's 401 then redirect, if it's 200 then process the information and send out the other requests?
This is presuming you have a way to distinguish the first request on a specific Msg | 2019-03-19T17:20:26.416300 | Slyvia |
elmlang | general | And assuming a valid session will stay alive during the time between receiving the first response and the other requests hitting the server, which seems reasonable | 2019-03-19T17:23:48.416600 | Slyvia |
elmlang | general | hi everyone, would anyone else find it useful to be able to refer to a value that is not meant to be used with a variable starting with underscore, instead of just the `_`, same as elixir? <https://hexdocs.pm/elixir/master/naming-conventions.html#underscore-_foo> | 2019-03-19T19:48:34.418500 | Nancy |
elmlang | general | maybe not for a prod release, but while I'm developing sometimes I ignore a variable but might use it later and it's good to keep it's semantic name | 2019-03-19T19:51:42.419600 | Tom |
elmlang | general | has this been discussed before? where would be the best place to propose it? | 2019-03-19T19:53:00.421100 | Nancy |
elmlang | general | If its not meant to be used, why does it exist at all? | 2019-03-19T19:54:57.423100 | Ashton |
elmlang | general | or why name something that’s not meant to be used? | 2019-03-19T19:55:32.424300 | Ruthann |
elmlang | general | `case result of ... Err _ ->` ? | 2019-03-19T19:55:59.426400 | Kymberly |
elmlang | general | you can declare `_` as the variable for more than one expression if that helps | 2019-03-19T19:56:09.426900 | Ruthann |
elmlang | general | I guess sometimes I do like:
```
case result of
Err error ->
-- Some code that doesnt use 'error'
```
But then, I dont know why I need to further signify that “error” is not used. | 2019-03-19T19:56:10.427000 | Ashton |
elmlang | general | if you've never written that, you have my hat tip and disbelief :wink: | 2019-03-19T19:56:15.427500 | Kymberly |
elmlang | general | `Err _err ->` is what I would do there | 2019-03-19T19:56:30.427800 | Kymberly |
elmlang | general | or `Err _` ofc | 2019-03-19T19:56:34.428000 | Kymberly |
elmlang | general | what’s the simplest way to create a function that squares a number? In Haskell it would be `(^2)`, but that doesn’t work in Elm. | 2019-03-19T19:56:38.428200 | Jacquelyn |
elmlang | general | `(**) 2` should do it | 2019-03-19T19:56:59.428600 | Kymberly |
elmlang | general | prolly just `square = ^` | 2019-03-19T19:57:03.428800 | Ruthann |
elmlang | general | wait no it won't | 2019-03-19T19:57:04.429000 | Kymberly |
elmlang | general | I have come across a few cases (especially String -> Maybe SomeType) functions where I had to specify the case _ -> Nothing. Then later I would forget to come back and handle a new case.
Case statements are exhaustive on the input type but not on the output type. What if we had the possibilty to specify that we expect the output of a case statement to cover all possibilities of a type. Would something like that even be possible and would you find it useful? | 2019-03-19T19:57:17.429200 | Jillian |
elmlang | general | `square` wouldn’t square any arguments though. It would take 2 arguments, just like `^` | 2019-03-19T19:57:56.429600 | Jacquelyn |
elmlang | general | `\n -> n^2` is the only way I think | 2019-03-19T19:58:03.429800 | Kymberly |
elmlang | general | Does Elm not have a `flip` function? | 2019-03-19T19:58:25.430100 | Jacquelyn |
elmlang | general | used to but doesn't any more | 2019-03-19T19:58:32.430300 | Kymberly |
elmlang | general | used to in 0.18 | 2019-03-19T19:58:33.430500 | Ruthann |
elmlang | general | I could do `flip (^) 2` if it did | 2019-03-19T19:58:42.430700 | Jacquelyn |
elmlang | general | `flip` was removed? | 2019-03-19T19:58:48.430900 | Jacquelyn |
elmlang | general | and a few other functions that were just too easy to write as an anonymous function. | 2019-03-19T19:59:09.431100 | Kymberly |
elmlang | general | decrease clutter i guess - but they might exist in the elm-extras packages | 2019-03-19T19:59:34.431300 | Kymberly |
elmlang | general | ok, so <@Kymberly> looks like you’re right, `\n -> n^2` is the way to go… | 2019-03-19T19:59:36.431500 | Jacquelyn |
elmlang | general | <https://github.com/elm-community/basics-extra> has the `flip` function | 2019-03-19T20:00:57.432900 | Kymberly |
elmlang | general | that’s a very interesting case ( mind the pun ) and i would definitely find it useful for decoding our backend enums which comes as strings into custom types | 2019-03-19T20:01:15.433800 | Ruthann |
elmlang | general | (fixed link) | 2019-03-19T20:01:17.434000 | Kymberly |
elmlang | general | instead now we have console errors and when i get them, the errors point me to the right file to update the enums | 2019-03-19T20:01:36.434700 | Ruthann |
elmlang | general | i mean i’ve used flip before:
```
sqr = flip (^) 2
```
but it seems a lot clearer to just write
```
sqr x = x ^ 2
``` | 2019-03-19T20:03:22.436400 | Ruthann |
elmlang | general | one case I would find useful would be in context to extracting part of a custom type, ie.
```
type A
= A1 Int Int
| A2 Int Int
aIndex : A -> Int
aIndex a =
case a of
A1 index _count ->
index
A2 index _count ->
index
``` | 2019-03-19T20:03:37.437000 | Nancy |
elmlang | general | firstly you don’t know what order of args the `(^)` function has, then you have to mentally swap the order you’ve just worked out. | 2019-03-19T20:04:02.437900 | Ruthann |
elmlang | general | I would find it useful to know the other options available in context to the case statment, not to forget the context of the function | 2019-03-19T20:04:14.438300 | Nancy |
elmlang | general | i suppose you can make `count_` a convention in your code? | 2019-03-19T20:04:54.439600 | Ruthann |
elmlang | general | Well the syntax would probably not be straight forward as you need to be able specify which type exactly you would like to cover exhaustively. Eg if your are doing String -> Result Html.Error MyType you would not want to cover all possible cases of Html.Error but maybe MyType | 2019-03-19T20:05:36.440900 | Jillian |
elmlang | general | another case would be functions like `List.indexedMap (\_index value -> value)` - I know this is not a good example given that `List.map` exists, but just to represent the use case | 2019-03-19T20:05:47.441100 | Nancy |
elmlang | general | tools like elm-analyse would still warn about this | 2019-03-19T20:06:21.441200 | Nancy |
elmlang | general | But maybe they are open to respecting this in the future | 2019-03-19T20:07:18.441500 | Jillian |
elmlang | general | ah hehe, can’t help you there.
the way i think about it, Elm gives you the ability to name variables you care about, and `_` to name any numbers of variables you don’t care about for destructuring. Your requirement is somewhat ambiguous, do you care about _count or not? if yes just name it `count`, if not, then `_`. | 2019-03-19T20:08:51.441700 | Ruthann |
elmlang | general | found this <https://github.com/elm/compiler/issues/1218#issuecomment-218835877> | 2019-03-19T20:10:28.442000 | Nancy |
elmlang | general | actually, i realise the way to do this is to write the reverse function first `MyType -> String` then use that in reverse to resolve the string ( by manually listing out all values of MyType or just having it as a compile time flag ) | 2019-03-19T20:12:15.442100 | Ruthann |
elmlang | general | definitely `sqr x = x ^ 2` is nicer. However, I wanted to write this inline: `map (flip (^) 2) myList` vs `map (\n -> n ^ 2) myList`. There, I like `flip` slightly more. Not a big deal though. More a curiosity about Elm syntax. | 2019-03-19T20:13:47.442300 | Jacquelyn |
elmlang | general | if you want `flip` you can easily write it | 2019-03-19T20:21:29.442500 | Earlean |
elmlang | general | Removing backticks, flip, custom operators etc. all contribute to the fact that people who know the concepts of Elm can truly read and understand anyone's code | 2019-03-20T03:25:22.442800 | Bert |
elmlang | general | The lack of type classes and qualified imports by default help a lot too, I think: the types are very explicit everywhere in typical Elm code. You can't confuse `Maybe` with `Task` in any way. As a Haskell beginner, I often get confused when dealing with e.g. `IO (Maybe String)`. | 2019-03-20T03:31:03.443000 | Bert |
elmlang | general | Hi, I'm trying to upgrade some app to 0.19; so far I did all the work manually, now I'd like to try elm-upgrade.
Unfortunately I'm working behind a firewall; I believe this may be the reason for this error:
```{ MaxRedirectsError: Redirected 10 times. Aborting.
at ClientRequest.fn.request.res (/home/admin/app/node_modules/got/index.js:40:23)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at HTTPParser.parserOnIncomingClient (_http_client.js:551:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:115:23)
at Socket.socketOnData (_http_client.js:440:20)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
message: 'Redirected 10 times. Aborting.',
host: '<http://package.elm-lang.org|package.elm-lang.org>',
hostname: '<http://package.elm-lang.org|package.elm-lang.org>',
method: 'GET',
path: '/search.json',
statusCode: 301,
statusMessage: 'Moved Permanently' }```
I already:
- set http_proxy and https_proxy
- set up the root certificate (this was needed to let npm work properly)
I also tried to debug the connection using node
```const caw = require('caw');
const got = require('got');
got('<http://packages.elm-lang.org|packages.elm-lang.org>', { agent: caw() }, ()=> {});
```
the result was
```(node:17607) UnhandledPromiseRejectionWarning: RequestError: tunneling socket could not be established, statusCode=502```
so looks like a problem with the firewall setup
Any suggestion? Thanks a lot in advance
EDIT:
looks like the "caw" package can't properly tunnel our corporate proxy.
or at least I can't configure node to work properly | 2019-03-20T06:09:49.446500 | Epifania |
elmlang | general | I have a best practice-question: How do you handle cases where based upon something in the model you should either show something or nothing. This applies to for example error messages.
I often end up with something like this:
```
if model.somethingWentWrong then
showErrorMessage
else
text ""
```
There might be nothing wrong with doing it this way, but for me the else-branch feels off. | 2019-03-20T09:37:41.451000 | Chaya |
elmlang | general | This is ok. You could also return a `List (Html msg)`, with `[]` as the void case. | 2019-03-20T09:42:32.452100 | Jin |
elmlang | general | Hey folks, I was checking this repository <https://github.com/noahzgordon/elm-jsonapi> and they used an operator i can’t found from the Elm documentation which is `:=` like in
```
userDecoder : Json.Decode.Decoder User
userDecoder =
Json.Decode.object2 User
("username" := Json.Decode.string)
("email" := Json.Decode.string)
```
I can see it is expoed from `import Json.Decode exposing ((:=))` but I can’t find any documentation | 2019-03-20T09:51:17.453400 | Contessa |
elmlang | general | <@Contessa> I think that's from 0.18 | 2019-03-20T09:52:56.454000 | Nana |
elmlang | general | looks like it's equivalent to what's now called `Decode.field` | 2019-03-20T09:54:30.454800 | Nana |
elmlang | general | You’re right I found it in the 4.0.5 docs of Json.Decode, I didn’t check since the json api docs says it’s 0.19 compatible. Thank you! | 2019-03-20T09:55:19.454900 | Contessa |
elmlang | general | That's a dicey assumption. I mean, depending on your load, it could happen a lot of times per day. If you care, you have to design for the user experience of it... | 2019-03-20T10:14:44.455600 | Dede |
elmlang | general | I'm thinking about making something similar to <http://robowiki.net/wiki/Robocode>, but in javascript running in the browser.
For the api for the user coded bots, I would like a bit more typesafety than vanilla js offers.
Would love to hear what people think about making something like this using Elm? Is it possible? Would it be possible to compile and run user entered code in a way that makes sense? Any other tips, advice, suggestions? :) | 2019-03-20T10:28:31.462700 | Kay |
elmlang | general | (haven't played with elm before, so it would also be a øn interesting way to learn it.. I hope ;p) | 2019-03-20T10:29:13.464100 | Kay |
elmlang | general | <https://www.youtube.com/watch?v=WQFwnKVLDdI>
really cool talk on Robots and Elm | 2019-03-20T10:30:03.464200 | Rosa |
elmlang | general | it should be theoretically possible to compile user written code into an Elm app which controls a robot, and you could set up ports from JS to Elm that send "sensor data" to the Elm app and receives commands | 2019-03-20T10:38:01.464500 | Nana |
elmlang | general | probably a lot of work though, and it'd be mostly JS stuff rather than Elm code | 2019-03-20T10:39:26.464700 | Nana |
elmlang | general | afair thats the gist of the talk. johnny-five node sdk, and ports i believe | 2019-03-20T10:46:32.464900 | Rosa |
elmlang | general | Robocode is not actual robots :stuck_out_tongue: It's kind of a game, where you can code a Robots ai, and then you dump 2 or more robot ai's into an arena, and they fight until a winner is found :slightly_smiling_face:
So I'm planning on doing a bunch of Canvas stuff to show the battle :slightly_smiling_face: | 2019-03-20T10:49:17.465100 | Kay |
elmlang | general | Also have a look (including the source) at:
<https://package.elm-lang.org/packages/elm-community/html-extra/latest/Html-Extra#nothing>
and
<https://package.elm-lang.org/packages/elm-community/html-extra/latest/Html-Extra#viewIf>
and the Lazy variant. | 2019-03-20T11:00:36.465300 | Velia |
elmlang | general | another option is to use elm-svg, simpler than Canvas I think | 2019-03-20T11:29:22.465700 | Nana |
elmlang | general | and it lets you write more Elm instead of JS :wink: | 2019-03-20T11:30:07.465900 | Nana |
elmlang | general | Is it possible to get `Bytes` from `elm/bytes` through a port? It doesn't seem to be part of the supported types, what is the recommended way to get `Bytes` across? :smile: | 2019-03-20T12:42:53.467500 | Genesis |
elmlang | general | (I have a `UInt8Array` in JS) | 2019-03-20T12:43:32.467900 | Genesis |
elmlang | general | I guess you want to push them from Elm to JS? | 2019-03-20T13:00:32.468100 | Timika |
elmlang | general | In any case, you cannot reasonably interact with typed JS arrays using Elm yet. You have to create some form of intermediate format. | 2019-03-20T13:01:40.468400 | Timika |
elmlang | general | The other way around, I want to subscribe audio data being played to create a visualisation (similar to <https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Visualizations_with_Web_Audio_API>). | 2019-03-20T13:02:24.468600 | Genesis |
elmlang | general | I was wondering, is going via `String` reasonable? | 2019-03-20T13:02:49.468900 | Genesis |
elmlang | general | I use array of ints for that. | 2019-03-20T13:02:58.469100 | Timika |
elmlang | general | (and in one case even putting multiple values into one int which can house 4 bytes) | 2019-03-20T13:03:42.469300 | Timika |
elmlang | general | Doesn't that make me send ~8 times as much data through the port? From memory JS integers are encoded using doubles | 2019-03-20T13:03:49.469500 | Genesis |
elmlang | general | Yes, it’s bad for performance. Or at least not optimal. But you can go some distance with that approach. | 2019-03-20T13:04:00.469700 | Timika |
elmlang | general | I'll see if it's good enough. Any reason to stay away from String as the intermediary type? | 2019-03-20T13:04:42.469900 | Genesis |
elmlang | general | I haven’t thought about strings TBH, that’s an interesting idea! | 2019-03-20T13:05:09.470200 | Timika |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.