workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
Would be nice to know what the rest of the elm community thinks about fragments, but it seems no one is losing any sleep over that.
2019-04-06T22:59:09.680500
Maxwell
elmlang
general
I don’t see the usefulness
2019-04-06T23:10:28.680900
Kris
elmlang
general
If you need non-encapsulated lists in a keyed list, you can do that. Write a function `List (String, List (Html msg)) -> List (String, Html msg)` the only use i see right now is for definition lists, though doing that without this function doesn’t seem much harder and the keys would make more sense. My view on this right now is that it’s a nice trick for the react Dom to have, but I don’t think it’s necessary in Elm
2019-04-07T01:30:48.685600
Emilee
elmlang
general
It makes a lot more sense for React because of the focus on 'components'. Fragments give you the ability to have a list of elements as a single component which lets your list use all the features that React components have. For Elm all you'd be getting is the ability to hide that it's a list.
2019-04-07T01:43:29.687500
Earlean
elmlang
general
If such a thing did exist it would probably be called `Html.batch` as it does the same thing that `Cmd.batch` and `Sub.batch` do
2019-04-07T01:44:57.688300
Earlean
elmlang
general
Thanks, <@Earlean>, that makes sense.
2019-04-07T02:03:11.688700
Maxwell
elmlang
general
I have an issue with a `select` element, where it's using the first option from the list as value rather than the value in my model.
2019-04-07T02:05:28.691000
Maxwell
elmlang
general
<https://ellie-app.com/5bWFYzmFShya1>
2019-04-07T02:05:29.691100
Maxwell
elmlang
general
Did I do something wrong? The displayed text _is_ using the value from the model, so why isn't the `select` also?
2019-04-07T02:11:58.692200
Maxwell
elmlang
general
<@Maxwell> that’s not how select works. you need to set the `selected` attribute on the selected option: <https://ellie-app.com/5bWQB3xPmmMa1>
2019-04-07T02:18:06.692900
Maida
elmlang
general
Thanks, Peter. :100:
2019-04-07T02:21:16.694000
Maxwell
elmlang
general
Do you know if Elm supports a select's element `multiple` attribute? It will cost me a bit of time to come up with an example for that so I'm asking in advance.
2019-04-07T02:29:00.694800
Maxwell
elmlang
general
<https://package.elm-lang.org/packages/elm/html/latest/Html-Attributes#multiple>
2019-04-07T03:26:29.695000
Emilee
elmlang
general
Generally, elms vdom supports arbitrary attributes via <https://package.elm-lang.org/packages/elm/html/latest/Html-Attributes#attribute> and even properties (like JavaScripts `myEl.someProp = ...` via <https://package.elm-lang.org/packages/elm/html/latest/Html-Attributes#property> The latter is mainly useful for custom elements
2019-04-07T03:28:39.695100
Emilee
elmlang
general
<@Maxwell> just pinging so you see this since my answer took quite a while :)
2019-04-07T03:31:26.696500
Emilee
elmlang
general
Hello there! Someone advertised here a tool that was able to download elm docs for a project so that they are available offline. I can’t remember the name of this tool. Does anyone know what tool I’m talking about?
2019-04-07T03:57:11.699200
Concetta
elmlang
general
<@Concetta> do you mean <https://www.npmjs.com/package/elm-doc-preview>
2019-04-07T03:58:17.699500
Earlean
elmlang
general
great, thank you!
2019-04-07T04:03:27.699800
Concetta
elmlang
general
You can definitely get it as a JSON value but you'd probably have to stop using the elm/file package and write your own stuff instead. You'd create a file input element and use the `on` function from Html.Events to detect when a file is selected. `on` allows you to use a custom decoder on the JS event object. If just decode it to a `Json.Decode.Value` instead of a 'real' Elm type, you can pass that directly through a port. So your custom decoder would be something like: `<http://Json.Decode.at|Json.Decode.at> ["target", "files"] Json.Decode.value`
2019-04-07T05:09:05.700000
Ashlie
elmlang
general
Anyone else feel that the new Http library (2.x) makes working with Http Tasks disproportionately hard - I feel like I am reimplementing almost all of the `Response -&gt; Error` code because it is not exposed
2019-04-07T06:01:29.701700
Lynn
elmlang
general
Never used it myself but you might like <https://package.elm-lang.org/packages/jinjor/elm-req/latest/>
2019-04-07T06:24:38.701900
Lea
elmlang
general
We updates to http 2.x a while ago and we have not had any issues. Our back end systems send a common error format and we wrote a custom `Response -&gt; OurAppError` function that knows how to deal with status codes and response body such that we can bubble meaningful errors to our applications. So yeah, we did need to write a custom error function, but I'd expect that eventually most apps would like to map errors into a type that is clear.
2019-04-07T12:08:33.703000
Charity
elmlang
general
For example, it is helpful to know when a session expired vs getting an opaque 401 or 403 status and needing to figure it out. Our servers send a correct status code and context in the body of the reponse which allow us to map it into an Error type which we can use to dispatch a Cmd.
2019-04-07T12:11:26.703200
Charity
elmlang
general
I'm making some assumptions the issue here so hopefully this was helpful. :slightly_smiling_face:
2019-04-07T12:13:10.703400
Charity
elmlang
general
thanks, that's an interesting observation
2019-04-07T12:14:33.703600
Lynn
elmlang
general
What are you doing in the code inside of the port? I had a situation that was really easy to fix that might be the same thing.
2019-04-07T12:16:03.703800
Charity
elmlang
general
what led to my question was the docs for Http.task “Just like request, but it creates a Task. This makes it possible to pair your HTTP request with Time.now if you need timestamps for some reason. This should be quite rare.”
2019-04-07T12:18:31.704000
Lynn
elmlang
general
that felt like a rather narrow vision and what e.g. <@Charity> describes is a totally different reason for using task
2019-04-07T12:19:17.704200
Lynn
elmlang
general
and then there is the simple desire to compose http requests, which was my main interest initially
2019-04-07T12:19:47.704400
Lynn
elmlang
general
when you compose them, what is the use case? Are you trying to run 2 things at a time or run things sequentially (e.g. get the time, then use the value of time to make an http req?)
2019-04-07T12:20:36.704700
Charity
elmlang
general
no, mostly to create ‘joined’ data in a nosql database
2019-04-07T12:21:10.705000
Lynn
elmlang
general
how does an Elm task help write a relationship to a db? (I apologize for not understanding :disappointed: )
2019-04-07T12:21:51.705200
Charity
elmlang
general
save on thing, and use the id returned to create the object that links to it. Doing that in one go rather than passing via the update function in between
2019-04-07T12:22:38.705500
Lynn
elmlang
general
Ok.. so something like this? open a db transaction write something update something updatea something else commit transaction
2019-04-07T12:24:05.705700
Charity
elmlang
general
then if something in the task fails, rollback transaction
2019-04-07T12:24:54.705900
Charity
elmlang
general
yes
2019-04-07T12:26:05.706100
Lynn
elmlang
general
Aha.. my first thought is to put that transaction behind a single server endpoint.
2019-04-07T12:36:41.706400
Charity
elmlang
general
I see what you are saying now. I've always pushed batches of operations to a new endpoint so unfortunately, I don't have much insight on what you are doing.
2019-04-07T12:39:41.706600
Charity
elmlang
general
In our stack, we have the luxury of spinning up new API endpoints for batch operations on a DB. I know a lot of folks don't have this luxury.
2019-04-07T12:41:20.706800
Charity
elmlang
general
for good or for bad, we currently put the balance of the DB organisation on the client side
2019-04-07T12:41:34.707000
Lynn
elmlang
general
not sure where I should post this, but I'm facing a rather odd issue: <https://ellie-app.com/5c8kffC7j2fa1>
2019-04-07T12:43:43.707600
Krista
elmlang
general
as you can see in this ellie, having a non breaking space in the wrong place (namely, inside a tag, where it shouldn't be) raises the error `InvalidCharacterError: String contains an invalid character`
2019-04-07T12:44:44.707700
Krista
elmlang
general
having this error isn't the issue I'm facing, but rather the fact that *in my application* (a RSS reader) this causes an infinite "loop" : the application kinda "reloads" the content over and over, and ends up with an error somewhere in the virtualdom. So my real issue is that there's this infinite loop that brings my browser (and my CPU) to its knees.
2019-04-07T12:46:29.707900
Krista
elmlang
general
any idea how I could investigate that, or maybe an idea of what could be causing the issue ?
2019-04-07T12:47:49.708100
Krista
elmlang
general
Starting up a debugger seems to be a reasonable idea
2019-04-07T13:02:57.708300
Florencia
elmlang
general
We discussed doing this but the overhead of writing my own elm/file was too much. Honestly, being able to alias two versions of Elm/http would be ideal.
2019-04-07T13:55:56.710200
Cammy
elmlang
general
Is there a chart somewhere with the big O performance of data structures in Elm? (If not, does anyone know what the big O is for appending an array to another array?)
2019-04-07T14:38:56.711400
Jae
elmlang
general
It might be fastest to ask <@Patricia>
2019-04-07T14:40:28.711500
Florencia
elmlang
general
I think there were some blogposts with performance but I don't know how much the implementation in elm/core has deviated from the original exploration repo
2019-04-07T14:40:50.711700
Florencia
elmlang
general
I take it Robin is the person who implemented HAMT arrays in Elm?
2019-04-07T14:41:25.712800
Jae
elmlang
general
It’s O(m) (m being nr of elements in the other Array, although that might change in the not too distant future)
2019-04-07T14:41:40.713400
Patricia
elmlang
general
Thanks!
2019-04-07T14:41:49.713600
Jae
elmlang
general
(And yes, I implemented the thing :)
2019-04-07T14:42:06.714200
Patricia
elmlang
general
That tells me that there is a bug, and why, but sadly not why it results in a loop, which is my real issue here :/
2019-04-07T17:31:29.714800
Krista
elmlang
general
I’m wondering if there’s a comparison table for syntax and features between Elm and Typescript. I know there’s one for javascript that ~I can’t locate at the moment~. I plan to make one, but wondering if it already exists in some form.
2019-04-07T20:09:04.716600
Rheba
elmlang
general
Like this: <https://elm-lang.org/docs/from-javascript>, but for typescript.
2019-04-07T20:10:03.716700
Rheba
elmlang
general
That table lacks the feature comparison you're looking for.
2019-04-08T01:44:15.717300
Niesha
elmlang
general
The main difference between Elm and Typescript is that Elm is pure and is a change of paradigm, whereas Typescript wants to encode the things JS is doing in a type system.
2019-04-08T01:45:09.717500
Niesha
elmlang
general
I want to use highlight. JS highlight code, but when my page uses post request again to add content to the tag, the newly acquired content can't highlight, how can I solve it?
2019-04-08T02:26:50.720000
Carrie
elmlang
general
I use "hljs.init Highlighting OnLoad ();" in the elm compiled HTML file, but before the post request, my page status is onload, highlight.js cannot render the newly acquired content.
2019-04-08T02:36:50.720600
Carrie
elmlang
general
Using HLJS on content that's rendered by Elm is not great, since HLJS will change the DOM structure, making Elm's virtual-dom confused about the elements on the page. Maybe there's a custom element that incorporates highlighting for its contents?
2019-04-08T03:07:39.721200
Bert
elmlang
general
Oh, I misunderstood you. I thought you wanted to debug the crash in the library, not the loop in your app. Sorry
2019-04-08T03:09:06.721300
Florencia
elmlang
general
<https://github.com/elm/package.elm-lang.org> could see how elm does it, afaik the package website uses hljs too
2019-04-08T03:26:49.722400
Danika
elmlang
general
I will try to find it. Thanks very much
2019-04-08T03:45:40.722600
Carrie
elmlang
general
isn't TypeScript identical to JavaScript though? besides the type declarations
2019-04-08T04:29:09.722700
Nana
elmlang
general
I suppose you could make a comparison between Elm's and TypeScript's type declaration, that could be useful
2019-04-08T04:30:38.722900
Nana
elmlang
general
How to extract the response body from a status code 422 response in elm 0.19? In my case it includes important information what went wrong on the server (eg validation errors, like not unique email address on signup). But I can only extract the status code itself but nothing else from `BadStatus`.
2019-04-08T08:44:02.726600
Elisabeth
elmlang
general
By defining this <https://package.elm-lang.org/packages/elm/http/latest/Http#expectStringResponse>
2019-04-08T08:47:38.726900
Lea
elmlang
general
Assuming you mean Http 2.0.0
2019-04-08T08:48:15.727100
Lea
elmlang
general
<https://package.elm-lang.org/packages/jinjor/elm-req/latest/> could also be of help.
2019-04-08T08:48:26.727300
Jin
elmlang
general
yes 2.0.0; Thanks for your quick reply!
2019-04-08T08:52:09.727700
Elisabeth
elmlang
general
I kind of wish the error response would be returned as a `Value` or `String` by default :thinking_face: having to use `expectStringResponse` takes a lot of boilerplate, and isn't super simple for beginners
2019-04-08T09:07:26.728000
Nana
elmlang
general
I guess it encourages defining you own error type
2019-04-08T09:24:23.728400
Lea
elmlang
general
IMHO, the built in error type is sufficient for beginners. The ability to make a custom error type is great b/c everyone's upstream server sends down different things. Getting the custom error type and the abstraction defined early in a project will help for the life of the project. We did it in the middle/late phase of one project and we had to change a lot of code... The compiler helped, but it was still a bunch of work that could have been avoided.
2019-04-08T09:38:20.728600
Charity
elmlang
general
<@Elisabeth> - here is a gist that shows how you can decode a response to whatever you like. I took this from one of our production apps. I hope this helps. <https://gist.github.com/doanythingfordethklok/8b244264f4f5b7e999f4495c61053f15>
2019-04-08T09:46:35.728800
Charity
elmlang
general
But it's kind of redundant to define your own `Error` type and create all the boilerplate, when typically the only difference is that you want to change `BadStatus Int` to `BadStatus CustomResponse`
2019-04-08T09:46:36.729000
Nana
elmlang
general
which I'm guessing is why you didn't get around to it until later in the project
2019-04-08T09:47:16.729200
Nana
elmlang
general
we didn't get around it until later in the project b/c we were working on our product and kicked bubbling friendly errors until the end of the project
2019-04-08T09:48:10.729400
Charity
elmlang
general
the part is that http 2.0 came out in the middle of the project..
2019-04-08T09:49:09.729600
Charity
elmlang
general
I dont see much boilerplate. I see 1 type and 2 functions... and those things do exactly what my app needs them to do.
2019-04-08T09:50:50.729800
Charity
elmlang
general
hmm, am I missing something here? as far as I can tell the object contains a field named uri?
2019-04-08T09:58:11.730200
Emilee
elmlang
general
nevermind, apparently it was immutablejs, and because the toString is overridden you can't discern the two...^^
2019-04-08T10:01:24.731000
Emilee
elmlang
general
made a package for exactly this and more: <https://package.elm-lang.org/packages/jzxhuang/http-extras/latest/Http-Detailed> Found that we had to do the same thing in every project so made the boilerplate code into a package, if you only need to do it once or twice it's may be better to just use `expectStringResponse` to handle it yourself as explained above :hugging_face:
2019-04-08T10:16:23.731200
Glenda
elmlang
general
Hello! Does anyone have an idea why when I call `Browser.Navigation.Back`, `onUrlChange` is called twice, and feed first the current url and then the url I want to go back to?
2019-04-08T11:24:42.733300
Donya
elmlang
general
<@Donya> I know there is some weird Chrome bug with popstate, is it happening in every browser for you?
2019-04-08T11:31:49.735000
Brady
elmlang
general
i havent yet checked it in firefox
2019-04-08T11:33:38.735300
Donya
elmlang
general
<@Brady> One minute...
2019-04-08T11:33:50.735800
Donya
elmlang
general
<@Brady> Woah! It works in firefox
2019-04-08T11:34:31.736100
Donya
elmlang
general
@ I apparently only have the problem in chrome
2019-04-08T11:34:47.736400
Donya
elmlang
general
<@Brady> Is this a known issue? I've been tearing my hair out for the two hours trying to debug it :yum:
2019-04-08T11:35:47.737300
Donya
elmlang
general
chrome bug is known issue, to avoid that issue we are storing url in our model, then `onUrlChange` we compare new url with the url in the model
2019-04-08T11:41:50.739300
Brady
elmlang
general
got it. thanks so much for the help
2019-04-08T11:43:20.739500
Donya
elmlang
general
Are there any recent benchmarks of Elm and overall performance comparison to other libraries like React? I'm looking into using Elm for a performance critical project and I want to gather some data first.
2019-04-08T14:15:43.740600
Dayna
elmlang
general
What kind of metrics are you looking for? And what is the nature of the project?
2019-04-08T14:20:39.740700
Timika
elmlang
general
There is this older blogpost by Evan about the VDOM performance: <https://elm-lang.org/blog/blazing-fast-html-round-two>
2019-04-08T14:21:09.740900
Timika
elmlang
general
That is from way back in 2016, Elm has changed a lot since then. The nature of the project is a website where people will be betting on live events, imagine a lot of odds updating in real time and input latency is crucial, you don't want people to get upset because they missed their bet, especially on low-powered mobile devices.
2019-04-08T14:23:10.741200
Dayna
elmlang
general
<https://krausest.github.io/js-framework-benchmark/current.html>
2019-04-08T14:24:32.741400
Lea
elmlang
general
That’s very interesting. Especially the direct comparison between Elm and React there.
2019-04-08T14:29:20.741700
Timika
elmlang
general
<https://medium.freecodecamp.org/a-realworld-comparison-of-front-end-frameworks-with-benchmarks-2019-update-4be0d3c78075>
2019-04-08T14:32:01.742000
Dayna
elmlang
general
Indeed, I’m curious to see how much faster Elm can get over time
2019-04-08T14:32:07.742300
Lea