workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
elmlang | general | <@Claretta> thanks for the heads up. Luckily we have the rfc for [xmpp over websockets](<https://datatracker.ietf.org/doc/rfc7395/?include_text=1>). BOSH is long-polling. | 2019-04-14T22:09:22.173900 | Isaiah |
elmlang | general | Yep, nice. In my project I started with direct XMPP via TCP support and had to deal with all of the nested stream negotiations and it was a huge pain. Then when I got to rfc7395, I was simultaneously thrilled that the process was so much better and annoyed that I had to now have two different mechanisms. | 2019-04-14T22:46:50.174200 | Claretta |
elmlang | general | Thanks <@Lynne> | 2019-04-15T00:40:24.174500 | Lesli |
elmlang | general | > So `instanceOffsets[instanceIndex]` isn't possible. Only things like `instanceOffsets[5]` is supported (which is useless here).
I think there are some hacks you can do here at least <https://stackoverflow.com/questions/30585265/what-can-i-use-as-an-array-index-in-glsl-in-webgl> | 2019-04-15T04:29:26.175000 | Corinne |
elmlang | general | I'm making a little asteroids-like game just for fun. I think I'll go with timjs' library: there doesn't seem to be a way to place the origin of a polygon in its center in elm-canvas. I want to be able to control the origin so that when I rotate a polygon it rotates about its center of mass without me having to translate it or whatever.
It also seems a bit easier to compose things in in elm-collage. | 2019-04-15T05:21:04.179600 | Rosario |
elmlang | general | <@Hoa> ^^ | 2019-04-15T05:21:44.180000 | Rosario |
elmlang | general | <@Rosario> Have you considered using svg directly? Also welcome to <#C0K5RJ7LN|gamedev> if you’re not there already :) | 2019-04-15T05:23:38.183100 | Dorotha |
elmlang | general | yeah for vector graphics svg seems the simplest | 2019-04-15T05:25:47.184500 | Nana |
elmlang | general | <@Dorotha> Thanks for the invite :slightly_smiling_face: I did consider using svg directly, but wanted to see if something a bit higher level and elmier might work well | 2019-04-15T05:26:33.185100 | Rosario |
elmlang | general | I'll have a look at the svg docs, but I think I was concerned about the readme saying it was a bad api or something | 2019-04-15T05:27:24.186200 | Rosario |
elmlang | general | can somebody recommend a library for typescript that does elm style json decoding? | 2019-04-15T06:46:56.188700 | Desire |
elmlang | general | Thanks. If lists were supported, I could probably do something like then
```
uniform vec2 instanceOffsets[20];
main()
{
highp int index = int(instanceIndex);
mediump vec2 offset = vec2();
for (int i = 0; i < 20; i++)
offset += instanceOffsets[i] * float(index == i);
gl_Position = perspective * camera * rotation * vec4(position + vec3(offset, 0), 1.0);
vcolor = color;
}
``` | 2019-04-15T06:54:51.188800 | Jae |
elmlang | general | It doesn't get around the problem that I have to go through the entire array for each vertex but at least I don't have to do as much copy pasting (unfortunately since I don't have uniform lists I don't think this will save any copy pasting) | 2019-04-15T06:55:49.189000 | Jae |
elmlang | general | <https://github.com/gcanti/io-ts> | 2019-04-15T07:06:23.189400 | Dayna |
elmlang | general | thx | 2019-04-15T07:12:07.189600 | Desire |
elmlang | general | oh no i think i found a bug in the compiler ... ;_; | 2019-04-15T07:41:34.190100 | Gertrude |
elmlang | general | Can you post what error message you're getting? | 2019-04-15T07:43:32.190800 | Jae |
elmlang | general | Working with `Gizra/elm-all-set`, but every time I try to import it in my Main module I get this:
```
Failed to compile.
./src/Main.elm
Error: Compiler process exited with error Compilation failed
Success! Compiled 1 module.
elm: Map.!: given key is not an element in the map
CallStack (from HasCallStack):
error, called at ./Data/Map/Internal.hs:610:17 in containers-0.5.11.0-K2TDqgYtGUcKxAY1UqVZ3R:Data.Map.Internal
@ ./src/index.js 2:0-33 4:0-3
@ multi /home/annaia/.nvm/versions/node/v10.15.3/lib/node_modules/create-elm-app/config/polyfills.js /home/annaia/.nvm/versions/node/v10.15.3/lib/node_modules/create-elm-app/scripts/utils/webpackHotDevClient.js /home/annaia/.nvm/versions/node/v10.15.3/lib/node_modules/create-elm-app/node_modules/react-error-overlay/lib/index.js ./src/index.js
``` | 2019-04-15T07:44:13.191000 | Gertrude |
elmlang | general | That's a known issue. Do you compile with `--debug` flag? | 2019-04-15T07:45:25.191200 | Lynne |
elmlang | general | probably? I don't know specifically what the create-elm-app scripts do, but I'm assuming so | 2019-04-15T07:49:06.191400 | Gertrude |
elmlang | general | Yeah that's a pretty common one when you use `--debug` | 2019-04-15T07:49:37.191600 | Nana |
elmlang | general | Clearing elm-stuff sometimes helps | 2019-04-15T07:50:04.191800 | Nana |
elmlang | general | not in this case it seems. :disappointed: | 2019-04-15T07:50:42.192000 | Gertrude |
elmlang | general | `create-elm-app` does turn on debugging depending on `ELM_DEBUGGER` environment variable:
<https://github.com/halfzebra/create-elm-app/blob/master/config/webpack.config.dev.js#L177> | 2019-04-15T07:50:50.192200 | Lynne |
elmlang | general | Try setting it to "false" when running your build | 2019-04-15T07:51:09.192400 | Lynne |
elmlang | general | production builds work though, so yeah. I'll try the env var | 2019-04-15T07:51:23.192700 | Gertrude |
elmlang | general | Beware that you will lose access to debugger in this case | 2019-04-15T07:51:42.192900 | Lynne |
elmlang | general | that's the thingy that shows the app state right? | 2019-04-15T07:52:09.193100 | Gertrude |
elmlang | general | If you use it there is a workaround but it requires building elm compiler from source | 2019-04-15T07:52:11.193300 | Lynne |
elmlang | general | Yep | 2019-04-15T07:52:14.193500 | Lynne |
elmlang | general | blargh. that's a bummer. | 2019-04-15T07:52:26.193700 | Gertrude |
elmlang | general | As an alternative to the built in debugger, you can try this. <https://www.npmjs.com/package/elm-monitor> | 2019-04-15T07:52:58.193900 | Jae |
elmlang | general | assuming I switch then, is there an elmapp config key to turn off the debugger? | 2019-04-15T07:54:02.194200 | Gertrude |
elmlang | general | There was also an initiative on building devTools for Elm: <https://github.com/opvasger/elm-devtools> | 2019-04-15T07:55:04.194400 | Lynne |
elmlang | general | It does not seem updated since then though | 2019-04-15T07:55:20.194600 | Lynne |
elmlang | general | I don't know if there is one. I just comment out the line of JS code required to make elm-monitor work | 2019-04-15T07:55:25.194800 | Jae |
elmlang | general | Wait, are you talking about `create-elm-app`? | 2019-04-15T07:55:49.195200 | Lynne |
elmlang | general | `elm-monitor` does seem being a complicated solution | 2019-04-15T07:57:06.195400 | Lynne |
elmlang | general | Another option is to ditch `Gizra/elm-all-set` as it is basically a wrapper of `AssocList` | 2019-04-15T07:58:31.195600 | Lynne |
elmlang | general | Plenty of choices for you :slightly_smiling_face: | 2019-04-15T07:58:41.195800 | Lynne |
elmlang | general | Well, but that depends if the issue is in the set wrapper or in AssocList | 2019-04-15T07:58:59.196000 | Gertrude |
elmlang | general | It does | 2019-04-15T07:59:07.196200 | Lynne |
elmlang | general | it's the Set part that I need | 2019-04-15T07:59:13.196400 | Gertrude |
elmlang | general | Still an option though | 2019-04-15T07:59:13.196600 | Lynne |
elmlang | general | yeah you could just use `AssocList.Dict a ()` | 2019-04-15T07:59:26.196800 | Nana |
elmlang | general | I use AssocList and `--debug` and don't have this issue with building | 2019-04-15T07:59:26.197100 | Lynne |
elmlang | general | Yeah, and I could always just use my own wrapper that does what I need. | 2019-04-15T08:01:36.197300 | Gertrude |
elmlang | general | Pretty much copy&paste the module | 2019-04-15T08:02:34.197500 | Lynne |
elmlang | general | I can hardly imagine it changes | 2019-04-15T08:02:41.197700 | Lynne |
elmlang | general | I think the bug has to do with creating a `type alias` for a type from another module | 2019-04-15T08:02:50.197900 | Nana |
elmlang | general | It's interesting that it only happens when I use it from my Main module. | 2019-04-15T08:03:37.198100 | Gertrude |
elmlang | general | I have been using it fine in another module for ages now | 2019-04-15T08:03:51.198300 | Gertrude |
elmlang | general | OK, this is weird. I cannot get this to typecheck now. | 2019-04-15T08:12:28.198600 | Gertrude |
elmlang | general | What did you do? | 2019-04-15T08:12:53.198800 | Lynne |
elmlang | general | I threw together a quick wrapper of my own, and I get this same error I was getting before the compiler crash: | 2019-04-15T08:13:15.199000 | Gertrude |
elmlang | general | ```
Failed to compile.
./src/Main.elm
Error: Compiler process exited with error Compilation failed
[==================================================] - 1 / 1-- TYPE MISMATCH ------------- /home/annaia/projects/futuhours-next/src/Main.elm
I cannot update the `editingWeek` field like this:
202| ( { model | editingWeek = Just { week = wk, days = AnySet.empty, entries = [] } }, Cmd.none )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This `Just` call produces:
Maybe { days : AnySet.AnySet a, entries : List T.Entry, week : Int }
But it should be:
Maybe T.EditingWeek
Note: The record update syntax does not allow you to change the type of fields.
You can achieve that with record constructors or the record literal syntax.
Detected errors in 1 module.
@ ./src/index.js 2:0-33 4:0-3
@ multi /home/annaia/.nvm/versions/node/v10.15.3/lib/node_modules/create-elm-app/config/polyfills.js /home/annaia/.nvm/versions/node/v10.15.3/lib/node_modules/create-elm-app/scripts/utils/webpackHotDevClient.js /home/annaia/.nvm/versions/node/v10.15.3/lib/node_modules/create-elm-app/node_modules/react-error-overlay/lib/index.js ./src/index.js
``` | 2019-04-15T08:13:23.199200 | Gertrude |
elmlang | general | But this should work. EditingWeek is defined thus:
```
type alias EditingWeek =
{ week : Int
, days : AnySet Workday
, entries : List Entry
}
``` | 2019-04-15T08:14:07.199400 | Gertrude |
elmlang | general | I switched to using the literal syntax in the call and it works now. | 2019-04-15T08:18:10.199700 | Gertrude |
elmlang | general | (ie. I changed it from the raw record to explicitly calling `T.EditingWeek`) | 2019-04-15T08:19:08.199900 | Gertrude |
elmlang | general | So instead of doing `Just { week = wk, days = AnySet.empty, entries = [] } }` you do `Just (T.EditingWeek ...)` now, is it correct? | 2019-04-15T08:20:24.200100 | Lynne |
elmlang | general | Yeah. | 2019-04-15T08:20:32.200400 | Gertrude |
elmlang | general | That's weird | 2019-04-15T08:20:35.200600 | Lynne |
elmlang | general | That seemed to be enough to tip it off that it's the right type. | 2019-04-15T08:20:43.200800 | Gertrude |
elmlang | general | Seems like you have two `AnySet` types defined in different modules but having the same shape | 2019-04-15T08:21:29.201000 | Lynne |
elmlang | general | May it be the case? | 2019-04-15T08:21:55.201200 | Lynne |
elmlang | general | Nope. | 2019-04-15T08:22:10.201400 | Gertrude |
elmlang | general | Hm | 2019-04-15T08:22:14.201600 | Lynne |
elmlang | general | Then I don't understand :slightly_smiling_face: | 2019-04-15T08:22:22.201800 | Lynne |
elmlang | general | There's only one AnySet, defined in the AnySet module, and imported elsewhere as needed. | 2019-04-15T08:22:37.202000 | Gertrude |
elmlang | general | Though, the place where EditingWeek is defined is elsewhere from Model, which is elsewhere from Main | 2019-04-15T08:22:56.202200 | Gertrude |
elmlang | general | I wonder if it's struggling to follow the dependency chain? | 2019-04-15T08:23:05.202400 | Gertrude |
elmlang | general | No idea | 2019-04-15T08:26:26.202600 | Lynne |
elmlang | general | can you extract this part `{ week = wk, days = AnySet.empty, entries = [] }` to a helper function , with the type annotation `helper : Int -> EditingWeek` and then update the code like this `( { model | editingWeek = Just (helper wk) }, Cmd.none )` and see about which part the compiler complains then? | 2019-04-15T08:41:38.202800 | Sharon |
elmlang | general | oh you found a solution. I didn't catch that. Doesn't matter then :slightly_smiling_face: | 2019-04-15T08:46:49.203000 | Sharon |
elmlang | general | <@Dorotha> Trying to do something similar. Is <https://package.elm-lang.org/packages/elm-lang/svg/latest/Svg> what you're talking about? If so, is it actually upgraded to 0.19 yet? | 2019-04-15T10:15:57.203800 | Ocie |
elmlang | general | It is here <https://package.elm-lang.org/packages/elm/svg/latest/Svg> | 2019-04-15T10:16:33.203900 | Dorotha |
elmlang | general | `elm-lang` has become `elm` in 0.19 | 2019-04-15T10:16:56.204100 | Dorotha |
elmlang | general | ah thanks for that. Even google results are confused | 2019-04-15T10:18:13.204300 | Ocie |
elmlang | general | Does anyone have any strong opinions on canvas vs svg in Elm? Are either of the libraries that support them in Elm in better or worse shape at the moment? | 2019-04-15T10:23:28.205200 | Ocie |
elmlang | general | There is no canvas API in pure Elm, except for webgl canvas. | 2019-04-15T10:26:32.205400 | Dorotha |
elmlang | general | Isn't <https://package.elm-lang.org/packages/joakin/elm-canvas/latest/>? | 2019-04-15T10:35:56.205700 | Ocie |
elmlang | general | or you're saying that they depend on webgl under the hood | 2019-04-15T10:36:30.205900 | Ocie |
elmlang | general | I see, it requires a custom element to be defined on a page, if you’re happy with that :slightly_smiling_face: | 2019-04-15T10:41:18.206100 | Dorotha |
elmlang | general | The api looks nice | 2019-04-15T10:41:24.206300 | Dorotha |
elmlang | general | (With the caveat that I’m well aware of and pretty much in support of Elm’s stance on native/kernel code! :star:) If I’m understanding the state of things today, it looks like there’s no way to use <https://github.com/google/flatbuffers> with Elm today without a step where you serialize into/out of Elm data structures along the way? | 2019-04-15T12:29:58.208300 | Babara |
elmlang | general | <@Babara> looking through the flatbuffers code on github (<https://github.com/google/flatbuffers/blob/master/js/flatbuffers.js>) it looks like a pure elm version could be made using `elm/bytes`, it seems like it would be a good bit of work to do it though | 2019-04-15T12:52:46.209800 | Alicia |
elmlang | general | Ooooh, I forgot elm/bytes exists. | 2019-04-15T12:53:10.210100 | Babara |
elmlang | general | (I’m willing to do a good bit of work to make this viable.) | 2019-04-15T12:53:16.210500 | Babara |
elmlang | general | I'm blanking on the right way to do this. I want to conditionally add some HTML elements to a list. In Ruby, I'd do something like this:
```
elements = []
elements << header_element if show_header?
elements << is_new? ? new_element : old_element
```
That syntax is a bit janky, but gets at what I want to do. What's the best way to do this in Elm? | 2019-04-15T15:19:14.213400 | Marcus |
elmlang | general | One idea is to have a function that accept the original list, add a new element via `:: ` or just return the orginal list if it is not the case | 2019-04-15T15:22:14.215700 | Hoa |
elmlang | general | I tried writing it out like this:
```
[ if entry.showHeader then headerElement else text ""
, if entry.new then newElement else oldElement
]
```
It looked okay, until Elm format had its way with it. | 2019-04-15T15:25:07.219300 | Marcus |
elmlang | general | <@Hoa> True, but it feels like such a simple thing, that scattering the functionality across a few functions feels like overkill. | 2019-04-15T15:26:30.220500 | Marcus |
elmlang | general | ```
someFunc elements showHeader isNew =
elements
|> (\items -> if showHeader then headerEl :: items else items)
|> (\items -> if isNew then newElement :: items else oldElement :: items)
```
If you wanted it to be “more” functional, though I think the way you have it is nice | 2019-04-15T15:27:34.222200 | Chae |
elmlang | general | elm format might chang the formatting on that too though | 2019-04-15T15:28:05.222600 | Chae |
elmlang | general | LOL. It's a cruel mistress. | 2019-04-15T15:28:15.222800 | Marcus |
elmlang | general | OK, so in your case you always have a “second path” - you don’t really need that my “…just return the original list if it is not the case” | 2019-04-15T15:29:32.223900 | Hoa |
elmlang | general | <@Marcus> For conditional list building you can just do:
```
list bool =
[ "a list" ]
++ (if bool then
[ "bool was here" ]
else
[]
)
``` | 2019-04-15T15:41:41.224700 | Leoma |
elmlang | general | <@Leoma> nice | 2019-04-15T15:45:50.225100 | Marcus |
elmlang | general | ```
appendIf : Bool -> a -> List a -> List a
appendIf bool a list =
if bool then
list ++ [ a ]
else
list
items =
[ "a", "b", "c" ]
|> appendIf True "d"
|> appendIf False "123"
``` | 2019-04-15T15:46:56.225300 | Leoma |
elmlang | general | Keep in mind that the more efficient list operation is prepending… So perhaps consider `prependIf` and use `::` if performance becomes a concern. | 2019-04-15T15:48:45.226300 | Leoma |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.