workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
elmlang | general | That said, Rust has a much more substantial learning curve than most other languages because it has a pretty unique memory/pointer management model and that takes some getting used to. | 2019-03-25T09:23:47.676200 | Dede |
elmlang | general | more than C++? | 2019-03-25T09:24:09.676400 | Nana |
elmlang | general | The model is much better than C++’s. | 2019-03-25T09:24:30.676600 | Dede |
elmlang | general | But there are significant differences. | 2019-03-25T09:24:50.676800 | Dede |
elmlang | general | It also inhibits random memory access, which makes non-FP bearable to FP people. | 2019-03-25T09:25:00.677100 | Niesha |
elmlang | general | Sadly, no effect system though | 2019-03-25T09:25:08.677300 | Niesha |
elmlang | general | I should maybe write a Rust tutorial for Elmists. | 2019-03-25T09:25:10.677500 | Dede |
elmlang | general | Yeah, most of the core is written in a way that lets you write FP. | 2019-03-25T09:25:35.677700 | Dede |
elmlang | general | so it has lambdas and proper closures? | 2019-03-25T09:26:53.677900 | Nana |
elmlang | general | “It’s complicated” :wink: | 2019-03-25T09:27:04.678100 | Dede |
elmlang | general | Mostly the answer is “yes”. | 2019-03-25T09:27:22.678300 | Dede |
elmlang | general | Actually: it’s a full yes, but subject to the borrow checker. | 2019-03-25T09:27:38.678500 | Dede |
elmlang | general | So you can write this, where the `||` is a closure taking no arguments and `|req|` is a closure taking one argument:
```
my.code(|| {
service_fn(move |req| {
serve_https(config, req)
})
``` | 2019-03-25T09:29:10.678700 | Dede |
elmlang | general | But there are two complexities that come up. | 2019-03-25T09:29:49.678900 | Dede |
elmlang | general | `config` and `req` are captured variables. | 2019-03-25T09:30:05.679400 | Dede |
elmlang | general | Let’s say `req` isn’t referenced from anywhere else after this. Then the data can `move` into the closure — thus the keyword in front of `|req|` | 2019-03-25T09:30:48.680200 | Dede |
elmlang | general | But say `config` is — then you have a problem that this closure doesn’t control the lifetime of `config` necessarily. | 2019-03-25T09:31:21.680700 | Dede |
elmlang | general | Now, if `config` is of a type that implements `Copy` trait, no problem, the compiler will automatically copy it. | 2019-03-25T09:31:44.680900 | Dede |
elmlang | general | But realistically, it is not. | 2019-03-25T09:31:48.681100 | Dede |
elmlang | general | <@Valeria> We use Scala (as a FP language, not a better Java) with Sangria (<https://github.com/sangria-graphql/sangria>), but I sadly cannot recommend it fully. But it might be worth to check it out - just in case it fits nonetheless. | 2019-03-25T09:31:49.681300 | Timika |
elmlang | general | So you wind up writing this:
```
my.code(move || {
let config = config.clone();
service_fn(move |req| {
let config = config.clone();
serve_https(config, req)
})
})
``` | 2019-03-25T09:32:03.681400 | Dede |
elmlang | general | That’s the level at which manual management can bite. | 2019-03-25T09:32:11.681600 | Dede |
elmlang | general | “manual” | 2019-03-25T09:32:16.681800 | Dede |
elmlang | general | The borrow checker warns you — without the extra ` clone` calls the code won’t compile. | 2019-03-25T09:33:08.682300 | Dede |
elmlang | general | Rust feels too low level for most applications | 2019-03-25T09:35:43.682500 | Kris |
elmlang | general | ~It’s actually not.~ | 2019-03-25T09:35:54.683100 | Dede |
elmlang | general | Let me retract that. | 2019-03-25T09:36:01.683500 | Dede |
elmlang | general | I would recommend purescript if you want something Elm like for a backend | 2019-03-25T09:36:03.683700 | Kris |
elmlang | general | That has not been my experience. | 2019-03-25T09:36:05.683900 | Dede |
elmlang | general | Once the learning curve is achieved, I have not found it to be notably less productive than ‘higher level’ languages. | 2019-03-25T09:36:48.684200 | Dede |
elmlang | general | I've coded Scala for 4 years (now full PureScript), tell me your pains so I can add them to my list :smile: | 2019-03-25T09:43:15.684500 | Niesha |
elmlang | general | Yeah, it’s far from perfect. We had Scala at our company before switching to pure-FP some time ago. In that sense, having Scala already established was a big help. But now we’re looking for something better… But if I would say one thing about Scala I dislike the most, it’s “implicit hell”, especially with libraries like `cats`. | 2019-03-25T09:45:27.685000 | Timika |
elmlang | general | <@Valeria> if you want I can show a small bootstrap of what we currently use at a future meetup.
We currently use Haskell, without complicated extensions, it's quite close to Elm overall. | 2019-03-25T09:46:49.687400 | Caron |
elmlang | general | We had code break at runtime because an implicit was missing. Compiled fine, but had totally different runtime result. :disappointed: | 2019-03-25T09:48:37.687600 | Timika |
elmlang | general | I’m interested in a Haskell setup that is close to Elm - can you elaborate a bit what you think are do’s and dont’s? You mentioned complicated extensions, what qualifies as a complicated extension for you personally? | 2019-03-25T09:50:03.687800 | Timika |
elmlang | general | Most of them? :stuck_out_tongue: | 2019-03-25T09:50:54.688200 | Kris |
elmlang | general | Do you enforce this by some guideline document or is just every developer on the same page and tradeoffs between complexity and gain are made on the fly? | 2019-03-25T09:51:01.688500 | Timika |
elmlang | general | I heard that `OverloadedStrings` is basically a _must_. Do you think that’s true? | 2019-03-25T09:51:44.689100 | Timika |
elmlang | general | Yeah | 2019-03-25T09:52:07.689800 | Kris |
elmlang | general | _Someone_ needs to write a blogpost about this. *cough* *cough* | 2019-03-25T09:52:22.690200 | Timika |
elmlang | general | I have a lot of requests to a service that uses authentication. Sometimes the token expires and I get a 401 responsen and then I need to make a refresh request, update local storage though ports and the redo the initial request. Do anyone have a _good_ solution for this? I have tried one where I use Task so make a chain of requests with refresh and retry and then in the response sets both the response to the request and new session credentials in i got some. But it feels complex and I need to add credentials to every msg I have. | 2019-03-25T09:54:02.691900 | Luba |
elmlang | general | I was joking when I said most of them, when you read about them you can recognize which are "complicated", some are required for specific libraries, etc | 2019-03-25T09:54:20.692000 | Kris |
elmlang | general | Tbh, there are _tons_ of blog posts explaining extensions, see <https://ocharles.org.uk/pages/2014-12-01-24-days-of-ghc-extensions.html> for a pretty cool one | 2019-03-25T09:55:03.692200 | Kris |
elmlang | general | I find it incredibly hard to get into Haskell, not the language, but the ecosystem and best practices. | 2019-03-25T09:55:30.692400 | Timika |
elmlang | general | Yes, the ecosystem (package management and stuff) is terrible in my opinion. | 2019-03-25T09:56:13.693200 | Kris |
elmlang | general | We had a “getting started with haskell” brownbag session. And most folks had to compile IDE support (<https://github.com/haskell/haskell-ide-engine>) from source and we basically did not do anything. It was very telling. | 2019-03-25T09:57:04.694100 | Timika |
elmlang | general | And another question. Is there a differens between Http.request and Http.task. When using Http.task I get a 403 from the server even though the arguments are identical (except that task doesn't take "tracker"). | 2019-03-25T09:57:33.694800 | Luba |
elmlang | general | Yup, that's pretty much it, I use nix which alleviates some of that (it has binary caches with prevent you from having to build some things from source) but it's still quite flaky | 2019-03-25T09:59:12.695100 | Kris |
elmlang | general | Our setup on the backend is Servant + Elm-export (it generates elm equivalent types to your haskell types, and all the encoders/decoders you need). We then basicly only use the very basic things : custom types, maps, folds, etc. | 2019-03-25T09:59:19.695300 | Caron |
elmlang | general | There is, indeed a bit of complexity in a part of our system which I won't name (it starts with M), but people don't need to manipulate it when creating new feature. | 2019-03-25T10:00:09.695500 | Caron |
elmlang | general | And I had to implement my own resolver like this:
```resolveJson : Json.Decode.Decoder a -> Http.Resolver Http.Error a
resolveJson decoder =
Http.stringResolver <|
\response ->
case response of
Http.BadUrl_ url ->
Err (Http.BadUrl url)
Http.Timeout_ ->
Err Http.Timeout
Http.NetworkError_ ->
Err Http.NetworkError
Http.BadStatus_ metadata body ->
Err (Http.BadStatus metadata.statusCode)
Http.GoodStatus_ metadata body ->
case Json.Decode.decodeString decoder body of
Ok value ->
Ok value
Err err ->
Err (Http.BadBody (Json.Decode.errorToString err))
``` | 2019-03-25T10:02:03.696200 | Luba |
elmlang | general | We use lots of extensions, but they don't really require knowledge (OverloadedStrings, DeriveGeneric, FlexibleContexts, etc). | 2019-03-25T10:02:21.696300 | Caron |
elmlang | general | It fails on the OPTIONS request that it seems like my browser automatically makes when doing a POST | 2019-03-25T10:03:24.697000 | Luba |
elmlang | general | > We had a “getting started with haskell” brownbag session. And most folks had to compile IDE support
The problem with that is that many people doing Haskell are vi/Emacs users. The guy who does IDE support is a great person, but many in the community are used to generic dev tooling. | 2019-03-25T10:03:44.697100 | Caron |
elmlang | general | yes, it will send OPTIONS pre-flight, make sure your server can handle it | 2019-03-25T10:04:31.698000 | Cindie |
elmlang | general | A wonder if perhaps "allow origin" or something like that is different. It doesn't seem like Chromium shows everything in the developer console | 2019-03-25T10:06:05.698800 | Luba |
elmlang | general | you can google more on this issue | 2019-03-25T10:11:23.699500 | Cindie |
elmlang | general | What more specifically do you mean? | 2019-03-25T10:12:05.699800 | Luba |
elmlang | general | Is it a known issue with Elm? | 2019-03-25T10:12:19.700200 | Luba |
elmlang | general | I mean google for more on "allow origin" and OPTIONS | 2019-03-25T10:14:26.701200 | Cindie |
elmlang | general | This is a good CORS guide.
<https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS> | 2019-03-25T10:19:42.701600 | Jin |
elmlang | general | Yeah. I know about that. But I would expect Elm to handle Http.task and Http.request identically. | 2019-03-25T10:23:26.702900 | Luba |
elmlang | general | I would love to have that <@Caron> :slightly_smiling_face: | 2019-03-25T10:24:23.703000 | Valeria |
elmlang | general | Ok. | 2019-03-25T10:26:19.704500 | Caron |
elmlang | general | As far as I could tell Elm set those three headers the same. But I'm not 100%. I'm no longer at my computer at the moment, so I will need to double check that the next time I have a chabce. | 2019-03-25T10:26:58.705800 | Luba |
elmlang | general | wtf, never had that one | 2019-03-25T10:42:35.706200 | Niesha |
elmlang | general | Our team is now at PureScript - it works. Not as fast as Rust, but pleasant to work with | 2019-03-25T10:42:56.706400 | Niesha |
elmlang | general | A bit newer guideline on which extensions to use: <https://lexi-lambda.github.io/blog/2018/02/10/an-opinionated-guide-to-haskell-in-2018/> | 2019-03-25T10:44:18.706600 | Niesha |
elmlang | general | `stack` solved most of our ecosystem issues. The IDE support still isn't great. | 2019-03-25T10:45:09.706900 | Niesha |
elmlang | general | At least compared to PureScript | 2019-03-25T10:45:28.707200 | Niesha |
elmlang | general | Hi all - how can I `uriEncode` a string? `Http` 1.x had this function but it has been removed in 2.x. | 2019-03-25T14:08:44.708700 | Tisa |
elmlang | general | Check out <https://package.elm-lang.org/packages/elm/url/latest/Url-Builder#QueryParameter> | 2019-03-25T14:24:20.708900 | Dede |
elmlang | general | Maybe you can fake something out of that? | 2019-03-25T14:24:36.709100 | Dede |
elmlang | general | Wait, better answer: <https://package.elm-lang.org/packages/elm/url/latest/Url#percentEncode> | 2019-03-25T14:25:39.709300 | Dede |
elmlang | general | Is there any package for rendering graphs which supports click/touch to drag stuff? | 2019-03-25T15:30:31.710000 | Kris |
elmlang | general | do you want this to be force-directed? elm-visualization has an example where you can drag the nodes, but then the force-direction kicks in and make the layout a little nicer. see also <https://erkal.github.io/kite/> | 2019-03-25T15:39:18.711300 | Virgie |
elmlang | general | elm-visualization example: <https://code.gampleman.eu/elm-visualization/ForceDirectedGraph/> | 2019-03-25T15:40:13.711500 | Virgie |
elmlang | general | Yes, that's a pretty cool example | 2019-03-25T15:54:11.711800 | Kris |
elmlang | general | Thanks! | 2019-03-25T15:54:15.712000 | Kris |
elmlang | general | `terezka/line-charts` supports clicks and dragging with some setup, see <https://terezka.github.io/line-charts/> | 2019-03-25T16:17:08.713000 | Agustin |
elmlang | general | I'll check it out, that kite looks like what I need but it doesn't provide that as a library, but as the whole project | 2019-03-25T16:18:34.713800 | Kris |
elmlang | general | hey everyone
any idea how to do jsonp request in Elm ? | 2019-03-25T17:49:36.714300 | Floy |
elmlang | general | basically am trying to access wakatime embedables | 2019-03-25T17:53:28.714600 | Floy |
elmlang | general | and that nasty thing works over jsonp...as far as I can tell from the snippet on their page | 2019-03-25T17:53:59.714800 | Floy |
elmlang | general | Hm, I appear to get plain old JSON responses :thinking_face: | 2019-03-25T18:08:18.715300 | Huong |
elmlang | general | e.g. <https://wakatime.com/share/@731fa8ee-eb30-4de1-912a-bbea6fcef812/4cfa1d8c-45e2-431d-affe-29638cef24e2.json> | 2019-03-25T18:08:22.715500 | Huong |
elmlang | general | yeah....it is | 2019-03-25T18:16:18.715700 | Floy |
elmlang | general | but in elm I get `Network failure` :confused: | 2019-03-25T18:16:26.715900 | Floy |
elmlang | general | no sorry | 2019-03-25T18:16:36.716100 | Floy |
elmlang | general | `NetworkError` | 2019-03-25T18:16:39.716300 | Floy |
elmlang | general | which doesn't make any sense | 2019-03-25T18:16:57.716600 | Floy |
elmlang | general | since I am on this slack | 2019-03-25T18:17:04.716800 | Floy |
elmlang | general | + Netflix is running | 2019-03-25T18:17:13.717000 | Floy |
elmlang | general | :confused: | 2019-03-25T18:17:14.717200 | Floy |
elmlang | general | <@Huong> URL is 100% correct, I can copy it into the browser and everything is ok | 2019-03-25T18:18:14.717400 | Floy |
elmlang | general | Am I not looking at CORS request? | 2019-03-25T18:20:49.717600 | Floy |
elmlang | general | oh...bugger...in the old code I've been using `jsonp` node module to do this request :confused: | 2019-03-25T18:23:36.717800 | Floy |
elmlang | general | You'll get `Network Failure` if CORS doesn't allow the request. | 2019-03-25T18:26:00.718000 | Earlean |
elmlang | general | that's really inconvienient | 2019-03-25T18:33:23.718200 | Floy |
elmlang | general | wonder if the only way is to port the module to Elm via ports or is there some header to set ;/ | 2019-03-25T18:33:40.718400 | Floy |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.