workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
However, using `[]` to represent "waiting for data" is kind of bad form. <http://blog.jenkster.com/2016/06/how-elm-slays-a-ui-antipattern.html>
2019-01-25T03:28:45.955500
Nana
elmlang
general
not excited about the asset handling
2019-01-25T03:43:28.955800
Desire
elmlang
general
<@Renda> I can report that elm-ui has been really nice so far! definitely the way to go for styling in Elm
2019-01-25T06:25:56.956200
Nana
elmlang
general
especially compared to the alternatives (I was pretty happy with component-scoped Stylus in Vue, but I found elm-css quite awkward in comparison, and elm-css-modules seems more like a workaround for when you already have tons of stylesheets that you don't want to rewrite)
2019-01-25T06:29:24.956400
Nana
elmlang
general
encountered one limitation so far: the tables currently don't support adding styles or event handlers to rows, only cells I was able to work around it though
2019-01-25T06:30:52.956600
Nana
elmlang
general
and the row/column/padding/spacing/align system is just perfect!
2019-01-25T06:32:09.956800
Nana
elmlang
general
<@Nana> hey that's great to hear! I can't wait to try it! But do you feel Elm-UI is better than SFC + stylus in Vue? (Since you said Elm-css was worse)
2019-01-25T07:22:55.957200
Renda
elmlang
general
<@Renda> yeah probably
2019-01-25T07:26:24.957400
Nana
elmlang
general
and definitely if you don't have years of experience with css
2019-01-25T07:27:01.957600
Nana
elmlang
general
I have not looked into it but how doesnt it actually work? Is the styling done via JavaScript and absolute positionings or is the output clever css?
2019-01-25T07:27:14.957800
Renda
elmlang
general
I'm definetly worst at css :stuck_out_tongue:
2019-01-25T07:27:46.958000
Renda
elmlang
general
it mostly uses css flexboxes, but with a nicer API
2019-01-25T07:29:04.958200
Nana
elmlang
general
Ok cool :slightly_smiling_face:
2019-01-25T07:30:48.958400
Renda
elmlang
general
Hello! Is there a way to make it so Elm does not overwrite the value of inputs when `update` is called?
2019-01-25T07:45:17.959200
Juliann
elmlang
general
<@Juliann> quite possibly, depending on what you mean by that. Is the problem that when you change your model, you have in your view inputs whose `value` attribute is set to the model's data?
2019-01-25T07:46:46.961000
Antonette
elmlang
general
The value is unchanging
2019-01-25T07:46:55.961400
Juliann
elmlang
general
Yet it is reset each time update is called
2019-01-25T07:47:16.962100
Juliann
elmlang
general
I'm suddenly realising that maybe `Html.Keyed` will help here as without it Elm can't avoid re-rendering my entire view, let me quickly try that
2019-01-25T07:48:16.964100
Juliann
elmlang
general
First thing that comes to mind is you could just not set the `value` attribute in your inputs. They won't change when the model changes.
2019-01-25T07:48:19.964200
Antonette
elmlang
general
Why don't you want your inputs to reflect your model's data though?
2019-01-25T07:49:09.964900
Antonette
elmlang
general
I need to set the initial value, can that be done without value?
2019-01-25T07:51:07.965500
Juliann
elmlang
general
And because the value isn't used afterwards by Elm, it's a normal HTML form
2019-01-25T07:51:27.966000
Juliann
elmlang
general
Ok.
2019-01-25T07:52:07.966200
Antonette
elmlang
general
<@Juliann> all inputs in Elm are controlled inputs, the `view` is a reflection of the `model`
2019-01-25T07:53:42.968500
Earlean
elmlang
general
You might have misunderstood something about the way Elm works ; the view is not just generated when you start the application. It's re-generated every time your model changes.
2019-01-25T07:53:57.968800
Antonette
elmlang
general
Yes, but it does incremental rebuilding
2019-01-25T07:54:46.970200
Juliann
elmlang
general
I thought that it would be smart enough to not rewrite this if the diff showed no change
2019-01-25T07:55:10.971400
Juliann
elmlang
general
Which, in turns, means that if you don't change your model when you put something in your input fields, and the view sets the value from the model's data, then every time something in your model changes, your view will be updated back to the model's initial value.
2019-01-25T07:55:13.971800
Antonette
elmlang
general
I'll try forcing it with lazy
2019-01-25T07:55:22.972100
Juliann
elmlang
general
What problem are you seeing that you're trying to avoid?
2019-01-25T07:55:25.972200
Earlean
elmlang
general
Input for which state have not changed are being re-rendered, causing their updated value to be reset
2019-01-25T07:57:13.972900
Juliann
elmlang
general
if they're unchanged, aren't they at their reset value?
2019-01-25T07:58:19.973400
Earlean
elmlang
general
No, because inputs can be updated outside of Elm
2019-01-25T07:59:00.973700
Juliann
elmlang
general
inputs being updated will produce a `input` event that you can listen for in Elm
2019-01-25T08:00:00.974500
Earlean
elmlang
general
And then I need to manage the state of this entire form, which would double the size of this program
2019-01-25T08:00:41.975200
Juliann
elmlang
general
Elm used to support this -&gt; <https://github.com/elm/html/commit/4912804dadbb2e7cdb6effa8ee737d2e08a96247>
2019-01-25T08:00:48.975600
Juliann
elmlang
general
Yes, if you have a form that you're rendering from Elm you should be storing it's state in the Elm model
2019-01-25T08:01:09.975900
Earlean
elmlang
general
I would agree if Elm did anything with it
2019-01-25T08:06:43.978200
Juliann
elmlang
general
Elm is responsible for perhaps 5% of the state here, the rest is plain old HTML
2019-01-25T08:06:57.978700
Juliann
elmlang
general
It's reinventing the wheel
2019-01-25T08:07:03.978900
Juliann
elmlang
general
And until 0.19 this was supported
2019-01-25T08:07:17.979200
Juliann
elmlang
general
you can recreate the defaultValue property yourself
2019-01-25T08:07:40.979500
Virgie
elmlang
general
on the other hand: if elm renders it, then elm does do something with it right?
2019-01-25T08:09:20.980400
Virgie
elmlang
general
It's a javascript element property, not a html property, so you cannot
2019-01-25T08:09:43.980800
Juliann
elmlang
general
I may be stuck here, sadly
2019-01-25T08:10:27.981300
Juliann
elmlang
general
I'm confused as to why `lazy` doesn't work
2019-01-25T08:10:40.981900
Juliann
elmlang
general
I'm not sure what you mean by that? you can implement the `defaultValue` as it existed in 0.18 yourself in 0.19
2019-01-25T08:10:56.982300
Virgie
elmlang
general
You cannot, it uses a Kernel module to set javascript properties on the virtual DOM. Only `elm/*` packages can do this
2019-01-25T08:12:26.983400
Juliann
elmlang
general
e.g. ``` import VirtualDom defaultValue : String -&gt; Attribute msg defaultValue v = VirtualDom.property "defaultValue" (Encode.string v) ```
2019-01-25T08:13:00.983900
Virgie
elmlang
general
yes but the kernel functionality is exposed, with exactly this sort of use case in mind
2019-01-25T08:13:48.984400
Virgie
elmlang
general
ooh, that's different from the way it is defined in core
2019-01-25T08:14:13.984800
Juliann
elmlang
general
let's try that :slightly_smiling_face:
2019-01-25T08:14:16.985100
Juliann
elmlang
general
it should be similar to the way it was defined in 0.18
2019-01-25T08:14:36.985400
Virgie
elmlang
general
In 0.18 it uses the Kernel module while other the other properties use the method you've shown
2019-01-25T08:15:50.986100
Juliann
elmlang
general
It works, wonderful
2019-01-25T08:16:22.986500
Juliann
elmlang
general
Thank you so much
2019-01-25T08:16:24.986700
Juliann
elmlang
general
:heart:
2019-01-25T08:16:44.987100
Juliann
elmlang
general
And now also this: <https://package.elm-lang.org/packages/pzp1997/assoc-list/1.0.0/> which works with any type, without a `k -&gt; comparable` function. Performance is different though.
2019-01-25T08:58:28.987400
Velia
elmlang
general
I'm trying to use elm-upgrade, but I get the following error message: ``` { MaxRedirectsError: Redirected 10 times. Aborting. at ClientRequest.fn.request.res (/home/fredrik/.npm-global/lib/node_modules/elm-upgrade/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' } ERROR: Unable to connect to <https://package.elm-lang.org>. Please try again later. ``` I am behind a corporate proxy, but `elm install` etc works fine.
2019-01-25T10:31:02.988500
Chaya
elmlang
general
Try installing a package you never installed with `elm install` to verify it is not the proxy's issue.
2019-01-25T10:32:20.989200
Lynne
elmlang
general
As of 0.19 `elm install` takes packages from local cache so it may not even need to go to Internet if package is cached already
2019-01-25T10:33:08.990100
Lynne
elmlang
general
I can open `<https://package.elm-lang.org/search.json>` on my machine
2019-01-25T10:34:19.990700
Lynne
elmlang
general
Getting 200, so it must be an issue with your corporate proxy
2019-01-25T10:35:08.991100
Lynne
elmlang
general
Oh. My. Lord! That is awesome! love how he’s like, it’s “asymptotically slower than elm/core” but works well on small-ish Dict’s. I was just going to add how irritable I was working with any-dict but I hadn’t heard of assoc-list! Woo!
2019-01-25T10:59:21.991300
Buffy
elmlang
general
Yes it's very useful, here is the announcement: <https://discourse.elm-lang.org/t/introducing-assoc-list-a-dict-substitute-with-custom-keys/2901>
2019-01-25T11:00:51.991500
Velia
elmlang
general
Noice!
2019-01-25T11:04:17.991800
Buffy
elmlang
general
This might help if performance is acceptable for your use case: <https://package.elm-lang.org/packages/pzp1997/assoc-list/1.0.0/>
2019-01-25T11:05:53.992000
Velia
elmlang
general
Yeah it all makes sense, it's just that in this case my life would have been a lot easier if I could have just `deriving Eq, Ord` on my `alias` :expressionless:
2019-01-25T12:16:10.992500
Bernardo
elmlang
general
Perhaps I'm just spoiled by Elm
2019-01-25T12:16:17.992700
Bernardo
elmlang
general
(expecting things to be so easy)
2019-01-25T12:16:27.992900
Bernardo
elmlang
general
Love it <@Nana>!
2019-01-25T12:17:58.993200
Bernardo
elmlang
general
Amusingly I actually use that ``` type RemoteData e a = NotAsked | Loading | Failure e | Success a ``` pattern elsewhere, when submitting a form. For some reason it didn't click that I could follow it for loading also :tada:
2019-01-25T12:18:58.993400
Bernardo
elmlang
general
I remember seeing a few (IIRC) <@Leonie> talks which feature a slide showing a loop of (IIRC) Build :arrow_right: Learn :arrow_right: Refactor :rewind:. Does this sound familiar to anyone?
2019-01-25T12:59:32.995400
Bernardo
elmlang
general
vaguely yes, though i think instead of Learn it was Discover
2019-01-25T14:02:35.995900
Lenore
elmlang
general
<@Bernardo> Is it this one? <https://youtu.be/x1FU3e0sT1I?t=2348>
2019-01-25T15:31:39.996900
Mammie
elmlang
general
That's it! :tada: Thanks <@Mammie>, what a hero!
2019-01-25T15:32:27.997600
Bernardo
elmlang
general
Hi folks! I have a somewhat interesting question. I'm writing a parser (using `elm/parser`) for a fairly simple syntax I've written for commands, which is sort of like a command line if you will with the possibility of multiple statements. Some of those statements will ultimately mutate some of the global state (add items for example), and then future statements might refer to those items added. In an Elm-esque way, i'm trying to figure out how to have a sort of "new stuff created" stack as part of the parser, so that I can check the *real* state and also check the *will be created but not created yet* state to let the user know about potential errors prior to running their commands
2019-01-25T19:38:23.000200
Loyce
elmlang
general
I'm not really sure how to go about that, somehow perhaps passing a simplistic model throughout all the parsers?
2019-01-25T19:38:45.000600
Loyce
elmlang
general
I guess there are many ways to do the same thing but I would keep the parsers about just parsing and creating the AST and then I’d do the type checking or interpretation part, which would raise those errors you are talking about if everything parsed correctly
2019-01-25T19:45:52.003400
Bebe
elmlang
general
So do a first pass
2019-01-25T19:46:18.003800
Loyce
elmlang
general
Then run it through another piece that will take that and do a sort of "fake" execution
2019-01-25T19:46:29.004000
Loyce
elmlang
general
and then assuming that checks out, do the real execution
2019-01-25T19:46:50.004200
Loyce
elmlang
general
That makes sense I think; once I have my Statement objects etc and I run them through a checker, I would be able to keep whatever state necessary
2019-01-25T19:47:12.004400
Loyce
elmlang
general
Thanks!
2019-01-25T19:47:58.004600
Loyce
elmlang
general
Anyone have a better way of describing a graph (for web audio) where the nodes can multiple inputs or outputs than the following: ``` graph [ node "apple" data , node "banana" data , node "watermelon" data , node "pineapple" data ] [ connect {output = "apple", input= "banana"} , connect {output = "apple", input "watermelon"} , connect {output = "banana", input "pineapple"} , connect {output = "watermelon", input "apple"} ] ```
2019-01-25T20:31:13.010200
Cammy
elmlang
general
or a less verbose version of `connect`: `connect ("banana", "apple")` I’m looking more for another paradigm or structure.
2019-01-25T20:32:45.011400
Cammy
elmlang
general
Is this a directed graph?
2019-01-25T21:47:48.011800
Carman
elmlang
general
I wonder if you could do something more concise like: ``` graph [ node "apple" data [ "banana", "watermelon" ] , node "banana" data [ "pineapple" ] , node "watermelon" data [ "apple" ] , node "pineapple" data [] ] ```
2019-01-25T21:51:52.013200
Carman
elmlang
general
where the third argument is a list of node ids you connect to
2019-01-25T21:52:16.013600
Carman
elmlang
general
Is there a way to encode a `Decode.value`? What I want to do is: `API request -&gt; decode as Value, because I don't care about the structure, nor can I predict it -&gt; Send this value through a port -&gt; work with it in JS -&gt; send the updated value back to elm`
2019-01-26T04:11:27.017800
Moshe
elmlang
general
I think `Encode.Value` and `Decode.Value` are interchangeable
2019-01-26T04:12:08.018400
Lynne
elmlang
general
Ok. Then I got at least that part right :smile: So how to use it in an encoder? I don’t know what to put at `???`: `Encode.object [ ("some_value", ??? obj.someValue ) ]`
2019-01-26T04:13:49.019800
Moshe
elmlang
general
Does not it work with just putting this value into the tuple? In other words, if you have `someValue : Decode Value` can't you just use `Encode.object [("some_value", someValue)]`?
2019-01-26T04:15:24.021200
Lynne
elmlang
general
`type alias Value = Json.Encode.Value`
2019-01-26T04:16:41.021700
Lynne
elmlang
general
Well… beat me to it. Wait a moment ^^
2019-01-26T04:16:44.021900
Moshe
elmlang
general
From `Decode.elm`
2019-01-26T04:16:45.022000
Lynne
elmlang
general
This is the same type
2019-01-26T04:17:05.022300
Lynne
elmlang
general
Why is it idiomatic to make subscriptions `mySubscription : (value -&gt; msg) -&gt; Sub msg` instead of just returning a `Sub value` and expecting the caller to call `Sub.map` like we do for `Html` and `Cmd`?
2019-01-26T08:33:02.024300
Rico
elmlang
general
<@Rico> I'm not sure what you mean, it's far more common for functions to take a function that will convert a value to a `msg` than to use `Html.map` or `Cmd.map`
2019-01-26T08:37:27.026300
Earlean
elmlang
general
Look at all the functions in the Html package or all the functions that return `Cmd msg` in the official packages
2019-01-26T08:38:26.028100
Earlean