workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
i don't need the loader
2019-01-24T04:38:42.872000
Desire
elmlang
general
screwed up yesterday, removed like 50 loaders due to the switch to parcel but forgotten the important ones
2019-01-24T04:39:44.872300
Desire
elmlang
general
Happens to the best. :smile:
2019-01-24T04:39:54.872500
Timika
elmlang
general
I need to focus an `input` element. Is there a way to do this in elm? `autofocus` attribute only works for page-loads, so thats not an option
2019-01-24T05:46:59.873500
Selene
elmlang
general
<https://package.elm-lang.org/packages/elm/browser/latest/Browser-Dom#focus>
2019-01-24T05:47:27.873700
Timika
elmlang
general
ah thx, the dom package moved into browser :thumbsup:
2019-01-24T05:48:06.874100
Selene
elmlang
general
Hi! Is there a way to subscribe to scroll events? There is the `Browser.Dom.getViewport` task. I could combine it with `onAnimationFrame`. Is there a more straight forward solution?
2019-01-24T05:56:05.876100
Ayesha
elmlang
general
<@Ayesha> is this something you would (in JS) use the `scroll` event for?
2019-01-24T05:57:58.876600
Virgie
elmlang
general
Yes. I need a Msg every time the viewport changes its position.
2019-01-24T05:58:35.877100
Ayesha
elmlang
general
there is this package that handles the `wheel` event which is similar <https://package.elm-lang.org/packages/mpizenberg/elm-pointer-events/latest/Html-Events-Extra-Wheel> (from a quick mdn search there are some differences though) otherwise you can implement your own event listener to `scroll` using <https://package.elm-lang.org/packages/elm/html/latest/Html-Events#on>
2019-01-24T06:02:36.878800
Virgie
elmlang
general
Thanks. I think the custom `on` event is the way to go.
2019-01-24T06:05:34.879300
Ayesha
elmlang
general
so I looked into `elm-ui`a bit earlier, and really liked the padding/spacing/alignment model... but I've been fiddling with CSS for 10 years, and didn't really want to have to learn a new styling system at the same time as learning Elm. I've also had quite a mixed experience with CSS frameworks - you often end up fighting the system when you want something a bit custom... but watching <@Cornell>'s talk right now, and it sounds really good! :grinning_face_with_star_eyes: I think I'm going to take the plunge and start converting some views into it
2019-01-24T07:12:41.888400
Nana
elmlang
general
Update us on how it goes. Because I have seen the talks and been thinking about trying them out too :slightly_smiling_face:
2019-01-24T07:15:33.888600
Renda
elmlang
general
did you meat to write elm-ui?
2019-01-24T07:36:46.889000
Desire
elmlang
general
<@Desire> ah right thanks :smile: elm-css is what I've been using so far and it's been a little bit annoying actually with some of the limitations it has
2019-01-24T07:39:53.889300
Nana
elmlang
general
interesting
2019-01-24T07:57:38.889500
Desire
elmlang
general
and yes, elm-ui is exciting
2019-01-24T07:58:34.889700
Desire
elmlang
general
Having spent most of my day on tweaking css with display: inline-block, flexbox and the occasional negative margin, I agree!
2019-01-24T09:38:54.889900
Renda
elmlang
general
yeah even when you know all the tricks, CSS is still fiddly. <@Leoma>
2019-01-24T10:04:40.890300
Nana
elmlang
general
I am using `elm-json-decode-pipeline` and I am trying to use optional but with a default value
2019-01-24T10:11:29.891300
Sadie
elmlang
general
If I use `optional "planning" (Decode.map Just decodePlanning) (Just Dict.empty)`
2019-01-24T10:11:44.891700
Sadie
elmlang
general
It tells me ```The argument is: Decoder (Maybe Planning -&gt; b)```
2019-01-24T10:12:39.892200
Sadie
elmlang
general
Ok can I make it a maybe.with default ?
2019-01-24T10:13:11.892500
Sadie
elmlang
general
I guess I should just remove all the Just and I should be fine
2019-01-24T10:15:25.893200
Sadie
elmlang
general
`optional "planning" decodePlanning Dict.empty`
2019-01-24T10:15:44.893500
Sadie
elmlang
general
would recommend elm-ui, it's awesome! writing CSS often comes down to how well you know all the tricks and loopholes... which is not how things should be :exploding_head:
2019-01-24T10:17:27.893800
Glenda
elmlang
general
I can also recommend <https://github.com/circuithub/elm-semantic-ui>
2019-01-24T10:23:22.894000
Zachary
elmlang
general
Even though elm-ui certainly has some gaps in features and a few bugs, I’m still 100% sold on it. Knowledge of CSS can help work around some of elm-ui’s current (and reasonably minor) issues/limitations.
2019-01-24T10:24:52.894300
Leoma
elmlang
general
Removing loaders is the best part when switching to parcel :smile:
2019-01-24T10:25:05.894500
Zachary
elmlang
general
<@Zachary> I think Elm-UI is way more interesting though, as it's more a language to replace CSS rather than just a set of predefined CSS classes
2019-01-24T10:31:27.894700
Nana
elmlang
general
I guess you must return a Maybe Dict with Dict.empty.
2019-01-24T10:36:18.896600
Tracey
elmlang
general
The way you're doing you are returning only the Just part, without the Nothing.
2019-01-24T10:36:55.897600
Tracey
elmlang
general
Folks, another question. I found myself in a situation that I think the compiler can help me to avoid. In a mistake I have a function A that returns function B then returns function A again. As a human I know that this will lead me to a infinite loop. But I'm wondering if there is a way we can make the compiler identify that misleading before it happen in runtime.
2019-01-24T10:47:26.902800
Tracey
elmlang
general
<@Tracey> totality detection isn't possible with a Turing-complete language :disappointed:
2019-01-24T11:01:41.904000
Niesha
elmlang
general
More context: <https://en.wikipedia.org/wiki/Halting_problem>
2019-01-24T11:06:28.904800
Timika
elmlang
general
You can detect some programs that won’t halt, you just can’t guarantee you’ll detect all of them.
2019-01-24T11:12:51.906000
Simon
elmlang
general
So the compiler could tell you if you’ve created something known to be infinitely recursive; some languages do do this already
2019-01-24T11:13:28.906700
Simon
elmlang
general
Elm does this for values (e.g. decoders, where people run into this fairly regularly)
2019-01-24T11:23:36.907800
Huong
elmlang
general
it doesn't do this for functions, and that's actually something used in the implementations of functions like `never : Never -&gt; a`
2019-01-24T11:24:15.908700
Huong
elmlang
general
(which is pretty much `never (Never v) = never v` given `type Never = Never Never`)
2019-01-24T11:24:47.909300
Huong
elmlang
general
hello everyone! I’m having a weird error that I never encountered before: ```The `Http` module does not expose a `Request` type. These names seem close```
2019-01-24T11:28:35.910200
Karrie
elmlang
general
this is my code: ``` import Http import Url.Builder exposing (QueryParameter) request : { body : Http.Body , expect : Http.Expect a , headers : List Http.Header , method : String , timeout : Maybe Float , url : String } -&gt; Http.Request a request = Http.request { body = config.body , expect = config.expect , headers = config.headers , method = config.method , timeout = config.timeout , url = config.url } ```
2019-01-24T11:28:51.910500
Karrie
elmlang
general
There is no `Request` type in the Http module anymore: <https://package.elm-lang.org/packages/elm/http/latest/Http>
2019-01-24T11:32:17.911400
Earnest
elmlang
general
functor is defined for as `for all a b.` of course you can use it in case where `a = b` but you can't say that thing that supports only this case is functor. if so then everything would be functor because this is true for any data type. It can be defined as `map _ a = a`
2019-01-24T11:32:49.911500
Zona
elmlang
general
therefore it doesn't even make sense to talk about this property at all.
2019-01-24T11:33:15.911900
Zona
elmlang
general
Check out the return type of `Http.request`: <https://package.elm-lang.org/packages/elm/http/latest/Http>
2019-01-24T11:33:16.912200
Earnest
elmlang
general
thanks!
2019-01-24T11:41:26.912600
Karrie
elmlang
general
is there a way to convert “2019-01-24T16:20:00Z” to a date time type?
2019-01-24T11:41:44.913000
Karrie
elmlang
general
I like the never type, though it should probably get first class type system treatment vs an interesting hack on the inference system. Then it’d free up Elm to help folks a little bit more in the other dimensions
2019-01-24T11:41:57.913100
Simon
elmlang
general
I think this is what you're looking for <https://package.elm-lang.org/packages/rtfeldman/elm-iso8601-date-strings/latest/Iso8601>
2019-01-24T11:42:29.913500
Virgie
elmlang
general
brilliant! :slightly_smiling_face:
2019-01-24T11:43:19.913800
Karrie
elmlang
general
how can I convert it to a readable datetime though? (from frontend)
2019-01-24T11:49:47.914000
Karrie
elmlang
general
you mean more readable than YYYY-MM-DDTHH:mm:ss.SSSZ?
2019-01-24T11:53:18.914200
Virgie
elmlang
general
it depends a little bit on what you want really. The readme of elm/time has an example <https://package.elm-lang.org/packages/elm/time/latest/>
2019-01-24T11:54:12.914400
Virgie
elmlang
general
Is the following worth reporting as a bug? ```$ elm make src/Router.elm elm: ./Data/Vector/Generic/Mutable.hs:703 (modify): index out of bounds (3,3) CallStack (from HasCallStack): error, called at ./Data/Vector/Internal/Check.hs:87:5 in vector-0.12.0.1-IfIQAgrX0q07Xkx6bkYLRX:Data.Vector.Internal.Check elm: thread blocked indefinitely in an MVar operation ```
2019-01-24T12:51:28.915400
Dede
elmlang
general
My plan is to report it unless someone here says it's known/fixed upstream in which case I'll ignore it.
2019-01-24T12:51:59.915500
Dede
elmlang
general
does it happen consistently?
2019-01-24T12:52:28.915700
Virgie
elmlang
general
100% of the time with the file at this point.
2019-01-24T12:52:38.915900
Dede
elmlang
general
(that is relevant because MVars are used in distributing work over multiple cores)
2019-01-24T12:53:24.916100
Virgie
elmlang
general
if there's not a duplicate then sure report it.
2019-01-24T12:53:58.916400
Virgie
elmlang
general
and if you have a good reproducable example than share it regardless
2019-01-24T12:54:15.916600
Virgie
elmlang
general
I had initially thought there wasn't a duplicate, but focusing on the MVar helped. This is probably what's going on: <https://github.com/elm/compiler/issues/1748> Thanks.
2019-01-24T12:58:15.916800
Dede
elmlang
general
<@Karrie> this is an excellent package for converting Time.Posix to Strings: <https://package.elm-lang.org/packages/ryannhg/date-format/latest/>
2019-01-24T13:20:58.917200
Nana
elmlang
general
<@Nana> I will have a look into it! Thanks!
2019-01-24T13:57:03.917700
Karrie
elmlang
general
Basically, one thread crashes with an exception because someone is using an unsafe operation, and then the deadlock detection kicks in - that's the MVar part.
2019-01-24T16:38:35.918500
Niesha
elmlang
general
Usually I've seen Evan tell people to create an issue if an SSCCE is available regardless whether one already exists in order to have more data on the matter.
2019-01-24T17:02:45.918800
Freda
elmlang
general
Is it considered bad form to have an `init` which says, e.g. {model = []}, but also has a command which does some HTTP and sends back the ‘actual’ values for `model`?
2019-01-24T19:20:54.920700
Bernardo
elmlang
general
Because: I’m having trouble with :arrow_up: , where the ‘actual’ values are loaded and sent back through a port (AFAICT from the JS side), but the model is never updated :disappointed:
2019-01-24T19:21:49.921900
Bernardo
elmlang
general
It occurs to me now I could just defer initializing the Elm app and send the ‘actual’ values through as a flag, but I wanted to see if there’s a consensus on this? :thinking_face:
2019-01-24T19:22:43.923000
Bernardo
elmlang
general
<@Bernardo> that's fine. It's not uncommon to have `init` produce a value for the model that shows it in a loading state and http requests to fetch data
2019-01-24T19:28:01.925400
Earlean
elmlang
general
<@Earlean> okay. So now the mystery begins: I switched to the ‘just send an initial value in flags’ approach and it works fine, so: Are there any known issue with having commands in initializers tripping over initial model values?
2019-01-24T19:35:02.927900
Bernardo
elmlang
general
If I fire off the command via e.g. a button, it works just fine, it just fails to do anything when I use it in `init` :thinking_face:
2019-01-24T19:38:51.929100
Bernardo
elmlang
general
Is that the root `init`? If inside a module, maybe is not wired up with the top init
2019-01-24T19:40:10.930400
Carrol
elmlang
general
Yep, root `init`, I’m a bit of newbie, so this is my first Elm project, but still just one file and one `init` :slightly_smiling_face:
2019-01-24T19:41:03.931300
Bernardo
elmlang
general
I’ll try to make a repro.
2019-01-24T19:41:08.931600
Bernardo
elmlang
general
<@Bernardo> commands aren't going to see you model value, the command will produce a Msg value that will be passed to your `update` function
2019-01-24T19:49:11.933700
Earlean
elmlang
general
I see you mentioned you are using a port. Have you subscribed to the port in your `subscriptions`?
2019-01-24T19:50:00.935600
Earlean
elmlang
general
Yeah, so I _presume_ `update` gets the message back via the port call in JS (which is triggered by the command fired off in the init)
2019-01-24T19:50:07.935800
Bernardo
elmlang
general
And that bit of `update` logic updates the model, but view doesn’t seem to change :grimacing:
2019-01-24T19:50:39.937100
Bernardo
elmlang
general
You send on a port with a command and receive from ports via `subscriptions`
2019-01-24T19:50:55.937600
Earlean
elmlang
general
Yep
2019-01-24T19:51:05.937800
Bernardo
elmlang
general
What’s extra weird is: <https://elmlang.slack.com/archives/C0CJ3SBBM/p1548376731929100>
2019-01-24T19:51:05.938000
Bernardo
elmlang
general
Do both the command and the button click produce the same Msg value?
2019-01-24T19:52:08.939100
Earlean
elmlang
general
Look at the case for the Msg value that your command would produce in your `update`
2019-01-24T19:54:15.940400
Earlean
elmlang
general
Yeah, same Msg
2019-01-24T19:58:26.940600
Bernardo
elmlang
general
I’m just whipping up a repro in Ellie
2019-01-24T19:58:37.940900
Bernardo
elmlang
general
Of course I’m sure I won’t be able to repro :joy:
2019-01-24T19:58:47.941200
Bernardo
elmlang
general
Ah, are you sending to the port in JS immediately after initialising the Elm app?
2019-01-24T20:01:50.942300
Earlean
elmlang
general
Sending to a port before Elm is ready doesn't work.
2019-01-24T20:03:02.943700
Earlean
elmlang
general
<@Earlean> so that’s what I was doing at first, and I had the same behavior, which made me thing, _I know, I’ll have a command fire in `init` to trigger the HTTP and port send back, that way I can be sure Elm is ready_. But that didn’t work :disappointed:
2019-01-24T20:05:42.945100
Bernardo
elmlang
general
Aaaand, it works as expected in my Ellie app :grimacing: <https://ellie-app.com/4xNRkmBRp2Va1>
2019-01-24T20:05:55.945500
Bernardo
elmlang
general
Who knows, I must have done something silly in my actual app.
2019-01-24T20:06:33.945900
Bernardo
elmlang
general
Sorry and thanks for putting up with me!
2019-01-24T20:06:40.946200
Bernardo
elmlang
general
This: <https://github.com/elm/compiler/issues/774>, specifically not being able to use a `type alias` as the key in a `Dict` seems crazy to me. Am I missing something?
2019-01-24T23:14:41.947000
Bernardo
elmlang
general
<@Bernardo> It's not related to `type alias` at all, it's about which types are `comparable`
2019-01-24T23:20:49.948100
Earlean
elmlang
general
some of the built in types are `comparable`, they have some reasonable ordering. `Int`, `String` etc. are `comparable`
2019-01-24T23:21:42.949200
Earlean
elmlang
general
By user defined types and records don't have a reasonable default ordering so you'd need some way to specify some how they should be ordered
2019-01-24T23:22:59.950600
Earlean
elmlang
general
Most do have a reasonable ordering, it's just not the way it works
2019-01-24T23:23:56.951600
Kris
elmlang
general
<@Bernardo> the way similar languages do this is by having types implement some kind of interface (a type class) that defines how values of that type should be ordered. Which leads us in to the discussion of why Elm doesn't have user definable or implementable type classes.
2019-01-24T23:25:49.953200
Earlean
elmlang
general
There are a few packages that provide wrappers around `Dict` that take a function of `(k -&gt; comparable)` so you can specify some function for converting your key values from some type to a type that is comparable. eg. <https://package.elm-lang.org/packages/turboMaCk/any-dict>
2019-01-24T23:32:30.955200
Earlean