workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
Right now, it says: ``` -- TYPE MISMATCH ----------------------------------------- src/SearchResults.elm Something is off with the 1st branch of this `case` expression: 209| callback (Results newResults) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This `callback` call produces: msg But the type annotation on `httpResponseToSearchResults` says it should be: SearchResults Hint: Your type annotation uses type variable `msg` which means ANY type of value can flow through, but your code is saying it specifically wants a `SearchResults` value. Maybe change your type annotation to be more specific? Maybe change the code to be more general? Read <https://elm-lang.org/0.19.0/type-annotations> for more advice! ```
2019-02-14T19:14:38.372900
Marcus
elmlang
general
I named the `(SearchResults -> msg)` parameter `callback`. Probably not the right name, but that's what it is right now.
2019-02-14T19:15:31.373900
Marcus
elmlang
general
I think the signature of httpResponseToSearchResults was off.
2019-02-14T19:16:36.374300
Marcus
elmlang
general
I just changed it to: ``` httpResponseToSearchResults : (SearchResults -> msg) -> Result Http.Error SearchResultsData -> msg httpResponseToSearchResults callback result = ... ``` And that made the error go away.
2019-02-14T19:18:00.375200
Marcus
elmlang
general
Question though, is there a more idiomatic name than `callback` for that parameter?
2019-02-14T19:18:18.375700
Marcus
elmlang
general
Or, a more idiomatic way to indicate what should be called, in the end?
2019-02-14T19:18:44.376400
Marcus
elmlang
general
It's common to call a function intended to produce a msg value `toMsg`
2019-02-14T19:19:28.377400
Earlean
elmlang
general
That makes sense.
2019-02-14T19:20:01.377800
Marcus
elmlang
general
Gotta run. I'm getting close. Thanks for everyone's help.
2019-02-14T19:25:32.378100
Marcus
elmlang
general
How can I convert a `input [typ_="date"][]` value to a Posix? Seems like elm gets the value as a string when you use onInput (in the format of "YYYY-MM-DD")
2019-02-14T21:17:44.379100
Nga
elmlang
general
<https://package.elm-lang.org/packages/elm/time/latest/Time> -- I'm seeing nothing here for converting a string or pieces of a string to a Posix
2019-02-14T21:18:02.379400
Nga
elmlang
general
The old elm stuff has this: <https://package.elm-lang.org/packages/elm-lang/core/latest/Date> -- I can't find a Date package in the latest core.
2019-02-14T21:18:31.379800
Nga
elmlang
general
<@Nga> yep, `elm/time` doesn't provide any parsers for handling string encoded date formats. There are other packages for parsing strings in to `Time.Posix`.
2019-02-14T21:30:04.381100
Earlean
elmlang
general
<@Earlean> when you say "other packages" do you mean stdlib, or third party?
2019-02-14T21:33:02.381600
Nga
elmlang
general
I'm assuming you mean third-party, like this: <https://package.elm-lang.org/packages/rtfeldman/elm-iso8601-date-strings/latest/> It's a shame that I have to rely on outside packages for something like this :disappointed: Shouldn't Elm support the date input type more thoroughly, and so give us a way to convert a iso8601 to posix? What am I missing here? Seems like an odd decision to exclude this functionality.
2019-02-14T21:36:38.383200
Nga
elmlang
general
<@Nga> if you scroll down to the 'iso8601' section of the Readme you can read the justification for why it's not supported.
2019-02-14T21:41:42.383900
Earlean
elmlang
general
<https://package.elm-lang.org/packages/elm/time/latest/>
2019-02-14T21:41:42.384100
Earlean
elmlang
general
<@Earlean> Thanks. I'd say that argument makes a lot of sense if there weren't such a thing as a date input which has very vast browser support. It would also make it easier for people to create custom datepickers. Even just a Posix constructor would be a sufficient work-around, and then people could parse the strings themselves and feed ints to a constructor.
2019-02-14T21:47:35.387000
Nga
elmlang
general
is anyone building a comprehensive widget lib for elm?
2019-02-14T22:19:01.387800
Lupita
elmlang
general
scrolling thru vue and react and omg so much there
2019-02-14T22:19:36.388200
Lupita
elmlang
general
<http://package.elm-lang.org|package.elm-lang.org> turns up a few hits on the term ‘widget’. Is there something specific you’re looking for?
2019-02-14T22:47:19.390300
Dede
elmlang
general
no really specific, just doesn't seem to maturing like you would think
2019-02-14T22:48:55.391700
Lupita
elmlang
general
A huge number of widget implementations aren’t really needed anymore as the web standards have improved. E.g., flexbox has solved a number of problems. It’s often not that hard to just… write the exact thing you want.
2019-02-14T22:49:52.392800
Dede
elmlang
general
well yes, i write some custom vue stuff all the time. we still use vuetify and others though
2019-02-14T22:50:35.394500
Lupita
elmlang
general
Now, elm-ui is a fascinating package that I personally love — it abstracts away html entirely and presents a rather nicer design language to work with.
2019-02-14T22:50:36.394700
Dede
elmlang
general
i need to mess with it more. been following this article <https://medium.com/@mickey.vip/an-approach-to-nested-reusable-view-functions-in-elm-a1531b9abaf3>
2019-02-14T22:51:01.395100
Lupita
elmlang
general
Elm has a very small community compared to Vue or React, there was previously a package for 'Material Design Lite' but it wasn't updated for Elm 0.19 and 'Material Design Lite' was discontinued.
2019-02-14T22:52:02.396100
Earlean
elmlang
general
sure i understand it's still relatively new
2019-02-14T22:52:53.396800
Lupita
elmlang
general
so going back to that article, would you mind if i ask a few questions?
2019-02-14T22:54:08.397400
Lupita
elmlang
general
the code that does event.onInput how do i know what parameters it's going to throw if i'm not familiar with that
2019-02-14T22:56:20.399800
Lupita
elmlang
general
I’m happy to take a shot at answers. I’m a relative newbie and not core, there are people (e.g. @ jessta) who can give much more informed answers too if they’re around.
2019-02-14T22:56:21.399900
Dede
elmlang
general
The core documentation is generally pretty good: <https://package.elm-lang.org/packages/elm/html/latest/Html-Events#onInput>
2019-02-14T22:57:13.400400
Dede
elmlang
general
So you’d start by seeing that it’s called `Evt.onInput` in the file, scroll to the top to see that `Evt` is defined by `import Html.Events as Evt`, then go look for the docs on the `Html` package by searching <https://package.elm-lang.org/> for `Html`
2019-02-14T22:58:44.401300
Dede
elmlang
general
that article is quite involved but gives some good info
2019-02-14T23:14:01.402800
Lupita
elmlang
general
If you haven’t written Elm yet, the article’s a bit of a deep-end dive.
2019-02-14T23:15:03.403100
Dede
elmlang
general
well makes sense and the partial application of the toInt with default waiting for the string parameter is cool but not easy to get until you look at it several time
2019-02-14T23:16:00.404100
Lupita
elmlang
general
maybe i should write my vue application that does a table sort by clicking on a column heard in elm and see how far i get
2019-02-14T23:20:40.404900
Lupita
elmlang
general
There was an elm-sortable-table package in 0.18 that forked in 0.19 — there are at least 3 forks on packages, e.g. <https://package.elm-lang.org/packages/NoRedInk/elm-sortable-table/latest/>
2019-02-14T23:22:36.405600
Dede
elmlang
general
yeah but more interested in figuring out the pieces, this has a sort, click handlers that pass to the sort and a way to get json data from a website. <https://github.com/rschneiderman0123/vue-table-sort>. ofc, i know vue much better than when i wrote this.
2019-02-14T23:24:06.407100
Lupita
elmlang
general
oh and has a computed function
2019-02-14T23:25:42.407800
Lupita
elmlang
general
anyways, back again tomorrow
2019-02-14T23:27:53.408700
Lupita
elmlang
general
hello, what field can i match this with? <https://gist.github.com/afidegnum/41ad46240fcf442b27cca862e482ee3a#file-main-elm-L460>
2019-02-15T00:27:15.409100
Leopoldo
elmlang
general
i m having an error, ``` This is not a record, so it has no fields to access! 460| response.status ^^^^^^^^ This `response` value is a: Int But I need a record with a status field! ```
2019-02-15T00:27:41.409400
Leopoldo
elmlang
general
<@Leopoldo> the answer is the same as it was 7 hours ago. You're using `elm/http 2.0.0` but your that code was written for `elm/http 1.0.0`
2019-02-15T00:30:41.410500
Earlean
elmlang
general
``` Http.BadStatus statusCode -&gt; String.fromInt statusCode ```
2019-02-15T00:31:01.410700
Earlean
elmlang
general
^ will work with `elm/http 2.0.0`
2019-02-15T00:32:43.411200
Earlean
elmlang
general
ok, thanks, it works
2019-02-15T00:34:20.411700
Leopoldo
elmlang
general
i will fun a test to find out
2019-02-15T00:34:31.412000
Leopoldo
elmlang
general
i m finding hard to solve this nuance .. <https://gist.github.com/afidegnum/41ad46240fcf442b27cca862e482ee3a#file-main-elm-L497> ``` The 3rd element of this list does not match all the previous elements: 494| [viewHeader 495| , pg.content 496| , viewFooter ] ^^^^^^^^^^ This `viewFooter` value is a: Route -&gt; List (Html.Html msg) But all the previous elements in the list are: List (Html.Html msg) ``` Adding `Route` type signature to the other designated ones breaks the whole structure, but `viewFooter` can't go away with the *Router* what do you suggest ?
2019-02-15T01:04:18.414000
Leopoldo
elmlang
general
do you have the route at this point in time?
2019-02-15T01:06:30.414400
Ruthann
elmlang
general
yes,
2019-02-15T01:07:02.414900
Leopoldo
elmlang
general
from your code, looks like you can just change ln497 to `++ viewFooter model.route` no?
2019-02-15T01:07:11.415100
Ruthann
elmlang
general
ok, i believe that works :slightly_smiling_face:
2019-02-15T01:09:50.415400
Leopoldo
elmlang
general
It's not optimal for a custom datepicker to return an ISO-string though. Better that they return a `Date` (from the justinmimbs/date package for example, which I think most Elm datepickers are already using :slightly_smiling_face:)
2019-02-15T03:25:39.415800
Nana
elmlang
general
Btw there is a ISO8601 package already, it's just not a core language library
2019-02-15T03:28:08.416000
Nana
elmlang
general
Hey beautiful people and vigilant bots, I have a growing problem and don't know how to address it: my team and I started adding bits and pieces of Elm in an existing app with the ambition to join them in one glorious SPA as soon as we cover all urls. So far, so good. Except for one thing: we're using `elm-webpack-loader`, and we have a main JS file to attach all our elm programs to the nodes they're allowed to squat in the app, and *every time we save one file, all the elm files are re-compiled and added to the main JS file* which is a very long process. So, is there a way to explain to `elm-webpack-loader` (or webpack?) that it only needs to re-build the parts that have changed and not those who aren't part of the changes? If so, how do I go about it? If not, what is your advice to turn this around? I can provide code samples but not the repo itself (and it's quite wide anyways so it'd be better if you tell me what you'd like to inspect anyways).
2019-02-15T05:02:32.424500
Antonette
elmlang
general
That sounds sort of similar to the situation NoRedInk was in, when they decided to build jetpack (<https://github.com/NoRedInk/jetpack>)
2019-02-15T05:04:24.424600
Huong
elmlang
general
Thanks for the lead :slightly_smiling_face:
2019-02-15T05:05:04.424800
Antonette
elmlang
general
Arf :neutral_face: It looks like it doesn't handle anything expect for Elm and CoffeeScript and we're also using Stylus to make our css stylesheets.
2019-02-15T05:08:20.425000
Antonette
elmlang
general
I’m using `elm-webpack-loader` and it doesn’t seem to have this issue? But I might be mistaken.
2019-02-15T05:12:39.425200
Agustin
elmlang
general
`parcel` might be another option, basically 0 config, plays nice with ore processors
2019-02-15T05:18:11.426200
Danika
elmlang
general
Thanks <@Danika>, I'll have a look :slightly_smiling_face:
2019-02-15T05:27:57.426400
Antonette
elmlang
general
While I'm happy for you that you don't seem to encounter that problem, I have to admit this doesn't help much <@Agustin>... :wink:
2019-02-15T05:29:03.426600
Antonette
elmlang
general
<@Antonette> I was confirming which package you are using?
2019-02-15T05:29:27.426800
Agustin
elmlang
general
e.g. try `elm-webpack-loader` rather than `webpack-elm`
2019-02-15T05:30:00.427000
Agustin
elmlang
general
Yep, I'm using `elm-webpack-loader` indeed.
2019-02-15T05:30:08.427200
Antonette
elmlang
general
(and it seems I gave a false indication in my original post, my bad)
2019-02-15T05:30:49.427400
Antonette
elmlang
general
Ah ok, your original post made it sound like you weren’t using it, apologies
2019-02-15T05:30:50.427600
Agustin
elmlang
general
i'm also using `elm-webpack-loader` but i don't have this issue :thinking_face:
2019-02-15T05:31:27.427900
Lilli
elmlang
general
Have you configured it in another way? Or are you building an SPA? (with only one elm entry point)
2019-02-15T05:32:03.428100
Antonette
elmlang
general
(here's my original configuration if you see something I did wrong): ``` { test: /\.elm$/, exclude: [/elm-stuff/, /node_modules/], loader: 'elm-webpack-loader?cwd=webpack/client' } ```
2019-02-15T05:33:37.428300
Antonette
elmlang
general
I have a single entry point, a simple JS file that handles the app initialization. This file loads the main elm file and from there on, further loading is done on the Elm side
2019-02-15T05:35:41.428600
Lilli
elmlang
general
``` { exclude: [/elm-stuff/, /env/, /node_modules/], test: /\.elm$/, use: { loader: 'elm-webpack-loader', options: { files: glob.sync("src/**/*.elm") } } }, ```
2019-02-15T05:35:42.428800
Agustin
elmlang
general
Thanks <@Agustin>, I'll try it right away :wink:
2019-02-15T05:37:56.429000
Antonette
elmlang
general
Just one thing though, I take it loading from the JS file is different with this `file` option?
2019-02-15T05:38:42.429200
Antonette
elmlang
general
(the Elm compiled file to import might not be named as it was or something?)
2019-02-15T05:39:17.429400
Antonette
elmlang
general
I’m still doing a `import { Elm } from './Main.elm';` in my bundle?
2019-02-15T05:40:08.429600
Agustin
elmlang
general
And I take it your `Main.elm` is one in the many programs?
2019-02-15T05:40:54.429800
Antonette
elmlang
general
(because my problem stems from the whole app having many programs we attach to various pages and not an SPA with only one program in a `Main.elm` file)
2019-02-15T05:42:14.430000
Antonette
elmlang
general
Like, in my case, I have a `Page` directory with many `.elm` files that each have a `Program`, and in my `index.js` file I do a `require('./Pages/NameOfTheProgramIWant.elm')` for each `Program` file.
2019-02-15T05:44:08.430200
Antonette
elmlang
general
So, if I do that, I'll have a "virtual" `./Main.elm` file to load that will be a compilation of all my `./Page/*.elm` files or something? (and `./Main.elm` is a convention of `elm-webpack-loader`?)
2019-02-15T05:47:24.430500
Antonette
elmlang
general
Ok, so I did this: ``` { test: /\.elm$/, exclude: [/elm-stuff/, /node_modules/], loader: 'elm-webpack-loader', options: { cwd: 'webpack/client', files: path.resolve(glob.sync('webpack/client/Pages/**/*.elm')) } } ```
2019-02-15T05:57:26.430900
Antonette
elmlang
general
And my main js file has this: ``` const Elm = require("./elm/Main"); console.log(Elm); ```
2019-02-15T05:58:24.431100
Antonette
elmlang
general
And I get this from webpack: ``` ERROR in ./index.js Module not found: Error: Can't resolve './elm/Main' in '/src/webpack/client' ```
2019-02-15T05:58:59.431300
Antonette
elmlang
general
What do you think I did wrong?
2019-02-15T05:59:20.431500
Antonette
elmlang
general
Hey, how do you concatenate two strings in Elm?
2019-02-15T07:12:41.432200
Logan
elmlang
general
<@Logan> `someString ++ anotherString`
2019-02-15T07:13:45.432600
Tamra
elmlang
general
TIL thank you!
2019-02-15T07:16:57.432900
Logan
elmlang
general
<@Antonette> where is your `elm` folder physically located compared to `index.js`?
2019-02-15T07:43:46.433200
Lynne
elmlang
general
It seems like you need to `require('../../elm/Main')` instead
2019-02-15T07:44:11.433400
Lynne
elmlang
general
(sorry <@Lynne> I've been away for lunch :sweat_smile:)
2019-02-15T07:52:39.433600
Antonette
elmlang
general
So, here's the gist of it: ``` - webpack.config.js - webpack/client/index.js // the base file that compiles to the final complete js file - webpack/client/Pages/**/*.elm // the base files for elm pages live here ```
2019-02-15T07:54:56.433800
Antonette
elmlang
general
Is there a way to get cryptographically secure random number native or do I need to use a port?
2019-02-15T07:58:54.434400
Olimpia
elmlang
general
:slightly_smiling_face:
2019-02-15T07:58:57.434600
Olimpia
elmlang
general
there is nothing official, so I think ports would be the best solution
2019-02-15T08:06:19.435100
Virgie
elmlang
general
tnx
2019-02-15T08:10:38.435400
Olimpia
elmlang
general
PSA to anyone using Elm with Webpack : I managed to hack proper color highlighting of type errors back in <https://github.com/rtfeldman/node-elm-compiler/issues/91> been using it for a day now, and it's so much nicer :relieved: (just edit the file in your node_modules folder) maybe someone can figure out how to do it properly later
2019-02-15T08:24:00.438100
Nana
elmlang
general
Oooooh! That's nice!
2019-02-15T08:25:30.438300
Antonette
elmlang
general
Sorry <@Antonette> I misunderstood your problem, I have checked my config against multiple Elm endpoints and it is compiling both
2019-02-15T08:25:59.438400
Agustin
elmlang
general
Worse it seems to make them both the same size
2019-02-15T08:26:06.438600
Agustin