workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
elmlang
|
general
|
The model has a viewport. And this should be set as soon as the section is createtd.
|
2019-02-16T05:18:49.515800
|
Cathey
|
elmlang
|
general
|
As the content is variable, I dont know it in advance
|
2019-02-16T05:19:28.516000
|
Cathey
|
elmlang
|
general
|
You're trying to have an event produced when the `section` appears in the `view`, but whether the `section` appears in the `view` is dependent on whether the `model` contains a certain value. So you should be asking, when does the model contain such a value?
|
2019-02-16T05:19:47.516200
|
Earlean
|
elmlang
|
general
|
It's common in ReactJS to do things like `componentDidMount` etc. this isn't how it's done in Elm. Because `view` elements in Elm can't hold state.
|
2019-02-16T05:21:05.516400
|
Earlean
|
elmlang
|
general
|
the state is in the model
|
2019-02-16T05:21:20.516600
|
Earlean
|
elmlang
|
general
|
Right! Then I need a state in the model, which controls the visibility of the view… thats the way round….
|
2019-02-16T05:22:33.516900
|
Cathey
|
elmlang
|
general
|
But however, at some point it has to be triggered by a message… which an elm app can never send itself but only by a Browser.Event or Dom function, HTML request or any other elm function that interacts with the outer world… conclussionn: what I want is not possible in elm, except with binding it to a port and subscribe to that…
|
2019-02-16T05:31:56.517200
|
Cathey
|
elmlang
|
general
|
if you had a port, when would you send to it?
|
2019-02-16T05:55:05.517400
|
Earlean
|
elmlang
|
general
|
I think you're missing the key point, either you `model` contains a value that would result in that `section` being in the `view` at `init` or some event happens that changes the `model` so that the `section` is in your `view`
|
2019-02-16T05:56:22.517600
|
Earlean
|
elmlang
|
general
|
if the value is there at `init` then `section` will be in the `view` at `init` so you can do this at `init`
|
2019-02-16T05:57:09.517800
|
Earlean
|
elmlang
|
general
|
yes. totally agree. But I did end up myself in a dead-end. I totally messed up my architecture. it works, but does not follow this pattern strictly… :disappointed:
|
2019-02-16T06:01:25.518000
|
Cathey
|
elmlang
|
general
|
Hi folks, I was under the assumption that `Html.lazy` would only be called if the passed value changed, but from this scsee <https://ellie-app.com/4KMM8RhbVpva1> it appears that lazy have no effect (it's called on each frame, not every second as it should).
|
2019-02-16T06:09:50.520200
|
Jonna
|
elmlang
|
general
|
<@Jonna> the function that you passed to `Html.lazy` is a different function each time
|
2019-02-16T06:11:45.520800
|
Earlean
|
elmlang
|
general
|
the trick to `Html.Lazy.lazy` is that it does 'reference comparison' rather than the usual 'value comparison' in the rest of Elm. This is an optimisation, doing a full value comparison would be very costly and would make the optimisation worthless.
|
2019-02-16T06:13:25.522500
|
Earlean
|
elmlang
|
general
|
ok
|
2019-02-16T06:17:46.523000
|
Jonna
|
elmlang
|
general
|
<@Jonna> <https://ellie-app.com/4KMW5QMCfxna1> is `Html.Lazy.lazy` functioning as expected
|
2019-02-16T06:17:54.523400
|
Earlean
|
elmlang
|
general
|
I didn't knew the function reference counted as well
|
2019-02-16T06:17:58.523600
|
Jonna
|
elmlang
|
general
|
it must, otherwise providing a different function wouldn't result in a change
|
2019-02-16T06:19:14.524600
|
Earlean
|
elmlang
|
general
|
which would be very unexpected
|
2019-02-16T06:19:26.524900
|
Earlean
|
elmlang
|
general
|
he idea was to throttle as an answer to : <https://discourse.elm-lang.org/t/many-messages-causes-slow-rendering/3150>
|
2019-02-16T06:19:34.525200
|
Jonna
|
elmlang
|
general
|
but it's not working as I thought it would (and am pretty sure it was a few years ago)
|
2019-02-16T06:20:12.525800
|
Jonna
|
elmlang
|
general
|
`Html.Lazy.lazy` has always been reference comparison
|
2019-02-16T06:20:46.526200
|
Earlean
|
elmlang
|
general
|
yes, for the value, but for the function I am fairly sure that in 0.15-ish it wasn't checking
|
2019-02-16T06:21:51.526900
|
Jonna
|
elmlang
|
general
|
anyways
|
2019-02-16T06:22:10.527100
|
Jonna
|
elmlang
|
general
|
thanks for the clarification :slightly_smiling_face:
|
2019-02-16T06:22:27.527500
|
Jonna
|
elmlang
|
general
|
The thing about `Html.Lazy.lazy` is that it's a transparent optimisation, it works the same whether or not the optimisation is happening or not.
|
2019-02-16T06:23:14.528400
|
Earlean
|
elmlang
|
general
|
if it didn't compare against the function then it would produce a different result than if it was just `identity` which would be very broken
|
2019-02-16T06:25:31.529800
|
Earlean
|
elmlang
|
general
|
Hello. I’m discovering the rtfeldman/elm-css package. I can’t figure how to use the transparent color value. This code does not compile because transparent has not the same type as hex “EEE”:
```
let
rowColor =
if item.even then
hex "EEE"
else
transparent
in
div
[ css [
backgroundColor rowColor
]
]
<| ...
```
|
2019-02-16T06:31:09.532600
|
Allyn
|
elmlang
|
general
|
An example in ellie: <https://ellie-app.com/4KNfXGNtWnVa1>
|
2019-02-16T06:41:35.533800
|
Allyn
|
elmlang
|
general
|
But thanks for your support :slightly_smiling_face:
|
2019-02-16T06:42:35.533900
|
Cathey
|
elmlang
|
general
|
I think you need `ColorValue (hex "EEE")`
|
2019-02-16T06:47:07.535100
|
Agustin
|
elmlang
|
general
|
Or make one somehow
|
2019-02-16T06:47:51.535800
|
Agustin
|
elmlang
|
general
|
<@Allyn> Try this instead:
```
rowBgColor =
if item.even then
backgroundColor (hex "EEE")
else
backgroundColor transparent
...
div [css [rowBgColor]] [...]
```
|
2019-02-16T06:48:31.536500
|
Lynne
|
elmlang
|
general
|
are fragments of views not functions?
<https://gist.github.com/afidegnum/d855c6201c855b1798e2a1826695df43#file-main-elm-L660>
gives me errors of
``` The `newPageForm` value is not a function, but it was given 1 argument.
660| , (newPageForm page)
^^^^^^^^^^^
Are there any missing commas? Or missing parentheses?
```
|
2019-02-16T06:52:41.537900
|
Leopoldo
|
elmlang
|
general
|
<@Lynne> it works, but I don’t understand why
|
2019-02-16T06:53:01.538300
|
Allyn
|
elmlang
|
general
|
Becuase `backgroundColor` accepts `ColorValue compatible`
|
2019-02-16T06:53:21.538900
|
Agustin
|
elmlang
|
general
|
As you mentioned `hex "EEE"` and `transparent` have different types
|
2019-02-16T06:53:26.539200
|
Lynne
|
elmlang
|
general
|
and returns the same thing, regardless of which colorvalue
|
2019-02-16T06:53:27.539300
|
Agustin
|
elmlang
|
general
|
OK, I get it! Thank you for your help
|
2019-02-16T06:53:54.540300
|
Allyn
|
elmlang
|
general
|
`backgroundColor` accepts any of these and is of type `Style` regardless of colour
|
2019-02-16T06:53:55.540400
|
Lynne
|
elmlang
|
general
|
<@Leopoldo> <https://gist.github.com/afidegnum/d855c6201c855b1798e2a1826695df43#file-main-elm-L540-L541> it's not a function
|
2019-02-16T06:55:39.540700
|
Earlean
|
elmlang
|
general
|
you can tell by the type signature, if it was a function then it's type would contain `->`
|
2019-02-16T06:56:20.541200
|
Earlean
|
elmlang
|
general
|
eg. `String -> Html msg` is a function, `Html msg` isn't a function
|
2019-02-16T06:56:49.541700
|
Earlean
|
elmlang
|
general
|
oh ok, :slightly_smiling_face:
|
2019-02-16T06:58:24.541900
|
Leopoldo
|
elmlang
|
general
|
still learning :slightly_smiling_face:
|
2019-02-16T06:58:30.542100
|
Leopoldo
|
elmlang
|
general
|
what's wrong with this code ? ``` onePage : Page -> Html msg
onePage page =
li [] [ text page.title
, a [ href page.id ] [ text page.title ]
, a [ href page.id ] [ text "Edit" ]
, a [ href page.id ] [ text "Delete" ]
]```
|
2019-02-16T07:18:28.542400
|
Leopoldo
|
elmlang
|
general
|
`The function expects 2 arguments, but it got 3 instead.`
|
2019-02-16T07:19:28.542600
|
Leopoldo
|
elmlang
|
general
|
<@Leopoldo> which function is that message about?
|
2019-02-16T07:23:10.543300
|
Earlean
|
elmlang
|
general
|
<https://gist.github.com/afidegnum/a9bb35747aab5f598ef12cd277cce84f#file-main-elm-L441>
|
2019-02-16T07:24:02.543500
|
Leopoldo
|
elmlang
|
general
|
it's ok, i have got it,
|
2019-02-16T07:24:34.543700
|
Leopoldo
|
elmlang
|
general
|
some intruding tag :smile:
|
2019-02-16T07:24:43.543900
|
Leopoldo
|
elmlang
|
general
|
appending lists via `,` or `++` doesn't seems to work at <https://gist.github.com/afidegnum/01faa688eb35104d2a0aa19b820132cc#file-main-elm-L436-L440>
`The (++) operator cannot append these two values:`
or
```
The 2nd element of this list does not match all the previous elements:
438| ul [] [(List.map onePage pages)
439|> , a [ href "/posts/new" ] [ text "Create new post" ]
440| ]
This `a` call produces:
Html.Html msg
But all the previous elements in the list are:
List (Html.Html msg)
```
|
2019-02-16T07:32:31.545200
|
Leopoldo
|
elmlang
|
general
|
any insight ?
|
2019-02-16T08:30:01.545500
|
Leopoldo
|
elmlang
|
general
|
`ul` takes two lists
|
2019-02-16T08:54:51.545900
|
Agustin
|
elmlang
|
general
|
The second list must contain `Html.Html msg`
|
2019-02-16T08:55:11.546500
|
Agustin
|
elmlang
|
general
|
You’re trying to have a sub list
|
2019-02-16T08:55:17.546900
|
Agustin
|
elmlang
|
general
|
You can’t do that
|
2019-02-16T08:55:20.547100
|
Agustin
|
elmlang
|
general
|
You need to do `(List.map onePage pages) ++ [a [] []]`
|
2019-02-16T08:55:35.547500
|
Agustin
|
elmlang
|
general
|
And you will probably need `()` around it to keep the compiler happy
|
2019-02-16T08:55:49.547900
|
Agustin
|
elmlang
|
general
|
i did that but the compiler won't budge :slightly_smiling_face:
|
2019-02-16T08:58:15.548200
|
Leopoldo
|
elmlang
|
general
|
You need to split yours lists like I said
|
2019-02-16T08:58:30.548500
|
Agustin
|
elmlang
|
general
|
if you remove `(List.map onePage pages),` from your first snippet it will compile
|
2019-02-16T08:58:48.549000
|
Agustin
|
elmlang
|
general
|
`ul [] ((List.map onePage pages) ++ [a [href "/posts/new" ] [text "Create new post"]])`
|
2019-02-16T08:59:23.549500
|
Agustin
|
elmlang
|
general
|
Note the lack of outer `[` brackets on the map
|
2019-02-16T08:59:33.549800
|
Agustin
|
elmlang
|
general
|
``` The 2nd element of this list does not match all the previous elements:
438| ul [] [(List.map onePage pages)
439|> , a [ href "/posts/new" ] [ text "Create new post" ]
440| ]
This `a` call produces:
Html.Html msg
But all the previous elements in the list are:
List (Html.Html msg)
```
|
2019-02-16T08:59:49.550200
|
Leopoldo
|
elmlang
|
general
|
`ul [] ((List.map onePage pages) ++ [a [href "/posts/new" ] [text "Create new post"]])`
|
2019-02-16T09:00:21.550700
|
Agustin
|
elmlang
|
general
|
that's the new modification <https://gist.github.com/afidegnum/04b9d7eae8f68c6016a1347a00d4ddd5#file-main-elm-L436>
|
2019-02-16T09:00:26.551000
|
Leopoldo
|
elmlang
|
general
|
No you can’t do that
|
2019-02-16T09:00:44.551500
|
Agustin
|
elmlang
|
general
|
??
|
2019-02-16T09:00:49.551700
|
Leopoldo
|
elmlang
|
general
|
`,` works only in `[]`
|
2019-02-16T09:00:50.551800
|
Agustin
|
elmlang
|
general
|
And `[List.map a b]` produces `[[]]`
|
2019-02-16T09:01:11.552200
|
Agustin
|
elmlang
|
general
|
Which is what you need to be trying to avoid
|
2019-02-16T09:01:16.552400
|
Agustin
|
elmlang
|
general
|
:slightly_smiling_face:
|
2019-02-16T09:01:23.552600
|
Leopoldo
|
elmlang
|
general
|
but by the way, here the link is at the buttom of the list, instead of top, that's why i wanted to move a href to the top before `ul`
|
2019-02-16T09:03:01.553800
|
Leopoldo
|
elmlang
|
general
|
<https://ellie-app.com/4KQFCc87zBSa1>
|
2019-02-16T09:17:23.554000
|
Agustin
|
elmlang
|
general
|
This is your code compiling
|
2019-02-16T09:17:26.554200
|
Agustin
|
elmlang
|
general
|
It doesn’t run because ellie seems to be missing Elm, no idea why.
|
2019-02-16T09:17:44.554600
|
Agustin
|
elmlang
|
general
|
This is it running but it won’t run in ellie <https://ellie-app.com/4KQL2CmQCqxa1>
|
2019-02-16T09:23:19.556600
|
Agustin
|
elmlang
|
general
|
Anyone else using the elm/file package. I am trying to use File.Select.files but the file browser that comes up is a single file select browser. I checked the kernel js code and it seems legit as it sets the multiple attribute to an empty string. BTW I couldn't find the installed elm packages src in my project directory (not in elm-stuff or couldn't find with a linux find command. If there is a way to access it, please let me know.
|
2019-02-16T09:25:53.558400
|
Raye
|
elmlang
|
general
|
Look in `~/.elm/0.19.0/package/elm/file/`
|
2019-02-16T09:27:45.558900
|
Agustin
|
elmlang
|
general
|
Are you sure its a single file browser? What happens if you hit shift while clicking
|
2019-02-16T09:28:13.559400
|
Agustin
|
elmlang
|
general
|
yeah i'm sure. I tried it on my mac and android phone.
|
2019-02-16T09:35:04.561500
|
Raye
|
elmlang
|
general
|
<@Leonor> it needs to sent `Http.requests` which is not i believe that could be the error, there are additional compilation errors i m trying to fix as well
|
2019-02-16T09:35:26.562000
|
Leopoldo
|
elmlang
|
general
|
<@Leopoldo> yes I changed a fair amount to make it compile
|
2019-02-16T09:35:46.562400
|
Agustin
|
elmlang
|
general
|
what other errors did you encountered ?
|
2019-02-16T09:36:51.562700
|
Leopoldo
|
elmlang
|
general
|
Not properly namespaced Decoders, Frame has the wrong type sig, etc
|
2019-02-16T09:37:34.563200
|
Agustin
|
elmlang
|
general
|
Just grab the ellie src and diff it
|
2019-02-16T09:37:39.563400
|
Agustin
|
elmlang
|
general
|
ah, ok, then let me use yours :slightly_smiling_face: thanks a lot,
|
2019-02-16T09:38:26.563800
|
Leopoldo
|
elmlang
|
general
|
well, this is my named "ELM Rest Sheet"
|
2019-02-16T09:38:53.564300
|
Leopoldo
|
elmlang
|
general
|
which can be used for any Rest based operations :slightly_smiling_face:
|
2019-02-16T09:39:04.564600
|
Leopoldo
|
elmlang
|
general
|
i m preparing a blog about it as well
|
2019-02-16T09:39:16.564900
|
Leopoldo
|
elmlang
|
general
|
<@Leonor> Gracias, it successfully compiled thanks a lot
|
2019-02-16T09:41:03.565400
|
Leopoldo
|
elmlang
|
general
|
It's just 'Elm', like the name of the type of tree. It's not an acronym so no need to put it in all uppercase.
|
2019-02-16T09:42:47.565600
|
Earlean
|
elmlang
|
general
|
what do you think needs improving ?
|
2019-02-16T09:42:59.565900
|
Leopoldo
|
elmlang
|
general
|
ok, thanks for the correction, I have a bad habit of uppercasing sentences :smile:
|
2019-02-16T09:44:01.566000
|
Leopoldo
|
elmlang
|
general
|
why is `elm-live` giving me file not found error ?
|
2019-02-16T10:10:31.566500
|
Leopoldo
|
elmlang
|
general
|
Can you share a little more context?
|
2019-02-16T10:10:51.566800
|
Regenia
|
elmlang
|
general
|
`$ elm-live src/Main.elm --open`
`Success! Compiled 1 module.`
from localhost:8000
I have a ```file not found``` error
|
2019-02-16T10:12:28.567000
|
Leopoldo
|
elmlang
|
general
|
Hmmm and an index.html was output?
|
2019-02-16T10:13:36.567700
|
Regenia
|
elmlang
|
general
|
no i didn't add the `index.html`
|
2019-02-16T10:14:19.567900
|
Leopoldo
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.