workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
My advice is to detect the case, no `_ -> ` and write to an error holder on your model
2019-04-19T21:24:06.077200
Willodean
elmlang
general
that way you can do something with the error, like send it to a port or show it to the user
2019-04-19T21:24:37.077600
Willodean
elmlang
general
Or re-write the thing in something with HKT? Purescript? Does purescript have something like elm-ui? That's the lib that keeps me stuck on elm at the moment?
2019-04-19T21:26:01.078900
Buffy
elmlang
general
HKT is not the issue
2019-04-19T21:26:31.079300
Willodean
elmlang
general
the problem is you need to convince the compiler that unaligned cases are impossible
2019-04-19T21:26:53.079800
Willodean
elmlang
general
that means that you need some for of dependent typing
2019-04-19T21:27:04.080200
Willodean
elmlang
general
where the type of the function can be determined by the value of its input
2019-04-19T21:27:15.080500
Willodean
elmlang
general
PureScript cannot do this either, unless they added existentials recently
2019-04-19T21:27:49.081500
Willodean
elmlang
general
haskell can only barely do this
2019-04-19T21:28:18.081900
Willodean
elmlang
general
and even then, its not ergonomic
2019-04-19T21:28:27.082300
Willodean
elmlang
general
the truth is you are running down the type level road, and that road lies maddness
2019-04-19T21:28:45.083000
Willodean
elmlang
general
you can invest hours upon hours of effort convincing the compiler this wont happen, and in practice have eliminated ZERO bugs
2019-04-19T21:29:16.084000
Willodean
elmlang
general
Yeh, I get the picture. So for now, just `Debug.todo` then upgrade that to something to track if the app ever hits any of these cases... maybe by then something else will exist that handles this sort of thing nicer?
2019-04-19T21:29:45.084400
Buffy
elmlang
general
In practice, I have this in my code `_ -> singleton x`
2019-04-19T21:30:08.084800
Willodean
elmlang
general
and never had a problem
2019-04-19T21:30:13.085000
Willodean
elmlang
general
We don't need the compiler to statically check everything
2019-04-19T21:30:25.085400
Willodean
elmlang
general
So you'd rather noop than fail?
2019-04-19T21:30:33.085800
Buffy
elmlang
general
we need the compiler to staticly check the things we are worried about
2019-04-19T21:30:34.085900
Willodean
elmlang
general
I have never needed to actually track stray messsages
2019-04-19T21:30:50.086400
Willodean
elmlang
general
I did for a while
2019-04-19T21:30:52.086600
Willodean
elmlang
general
but I deleted it because it was code to maintain that was not adding value
2019-04-19T21:31:04.087000
Willodean
elmlang
general
How many real world errors are caught by `Maybe`, shitloads
2019-04-19T21:31:43.087900
Willodean
elmlang
general
Gotta love that value stuff... what's that? kek. This is a project I'm workin' on in my free time so type level shenanigans are just questions I ask to learn. :slightly_smiling_face:
2019-04-19T21:32:03.088600
Buffy
elmlang
general
how many real world errors are caught by dependently typed complexity to ensure the compiler wont allow a stray message. Like zero.
2019-04-19T21:32:11.088800
Willodean
elmlang
general
Then you are in the wrong language
2019-04-19T21:32:28.089300
Willodean
elmlang
general
go idris or agda
2019-04-19T21:32:33.089600
Willodean
elmlang
general
idris has a javascript backend
2019-04-19T21:32:41.089900
Willodean
elmlang
general
Idris has a javascript backend?
2019-04-19T21:33:10.090500
Buffy
elmlang
general
yes
2019-04-19T21:33:55.091400
Willodean
elmlang
general
go have some real fun :slightly_smiling_face:
2019-04-19T21:34:07.091800
Willodean
elmlang
general
Elm has two use cases. Teaching beginners, and real world consumer facing applications where performance and space concerns are key.
2019-04-19T21:34:48.093100
Willodean
elmlang
general
Learning about types is not one of them. As is writing good FP code.
2019-04-19T21:35:05.093700
Willodean
elmlang
general
Just seems odd, this is the second time I've wanted to do dependently typed shenanigans... first time trying to map Http Headers to Persistent Queries for Pagination stuff... now randomly here trying to make update not have little weird edge case-y things... I'm scared of what I'll find if I go down the Idris brick road?
2019-04-19T21:35:17.093900
Buffy
elmlang
general
lol
2019-04-19T21:35:17.094100
Buffy
elmlang
general
You will find madness
2019-04-19T21:35:53.094300
Willodean
elmlang
general
You want to take a real hit off the Sandy type level programming?
2019-04-19T21:36:12.094800
Willodean
elmlang
general
You are going to have diminishing returns in the extreme, as you invest more and more time in types that don't catch real world problems, and don't add features to your app.
2019-04-19T21:36:43.095500
Willodean
elmlang
general
But its a beautiful madness, and an experience worth having
2019-04-19T21:36:54.095800
Willodean
elmlang
general
been down that road and back again my friend
2019-04-19T21:37:09.096100
Willodean
elmlang
general
you think you want dependent types, until you live with them in an enterprise production application
2019-04-19T21:37:27.096500
Willodean
elmlang
general
I'll take a word from the wise and hold off then for now. :slightly_smiling_face: Maybe one day there will exist a dependently typed language that solves all our problems with nice error messages :man-shrugging:
2019-04-19T21:39:13.098000
Buffy
elmlang
general
Blodwen ftw
2019-04-19T21:40:32.098200
Willodean
elmlang
general
:man-shrugging:
2019-04-19T21:42:41.098400
Buffy
elmlang
general
Sincere thanks for you time either way :slightly_smiling_face:
2019-04-19T21:46:22.098800
Buffy
elmlang
general
I am in the process of upgrading to elm-0.19 and I'm hitting this issue too ... works without `--debug`, but fails with that error when I use it in elm-live. My codebase is prohibitively large to extract a SSCCE :confused:
2019-04-19T22:52:27.099000
Tamika
elmlang
general
Has any advice been published on how to get rid of the security messages (in git/github) that come with using a 0.18 dev environment. I feel bad providing my clients with repos that have security warnings, even if the warnings only apply to dev packages
2019-04-20T03:49:28.100600
Lynn
elmlang
general
Hello, I hope somebody can help me with this weird behavior i've been getting: we have an application that runs 3 submodules which each have their own MVU cycle (own model, messages and update). We use this function to map these messages to the submodules <https://github.com/rtfeldman/elm-spa-example/blob/master/src/Main.elm#L280> . Now one of our submodules is doing a HttpRequest in a Command. We've put this command on the submodule's `init` function and can see the command being fired but the message never being received. However if we put the same command inside one of the submodules messages as a side effect it works fine. Why does this happen?
2019-04-20T05:16:39.103800
Olevia
elmlang
general
Maybe you case on the `Msg SubMsg` and `Page` to be ‘active’ at the same time?
2019-04-20T05:44:38.104100
Lea
elmlang
general
So stuff ends up <https://github.com/rtfeldman/elm-spa-example/blob/master/src/Main.elm#L276>
2019-04-20T05:45:00.104300
Lea
elmlang
general
Hey, is there a concern with my API? I don’t allow Msg without a Model. The rule is, you must ALWAYS start with one of: a model, or an error. Now, operations on errors (adding a Cmd Msg) simply result in the error. As opposed to getting combined with a model.
2019-04-20T13:34:08.108200
Leoma
elmlang
general
Rest in peace Joe Armstrong, you were a true functional programming brother, thanks for paving the way for the rest of us.
2019-04-20T14:36:22.109300
Ann
elmlang
general
Hello, I met Elm recently and ended up creating interest in learning it, because with Elm-UI I would save time not having to learn three different languages for front end. It seems that there is no updated or complete content about the language. Maybe that's one of the reasons that contribute to the low popularity of some languages. Can anyone help me?
2019-04-20T17:53:14.111600
Sandi
elmlang
general
what are you looking for in particular?
2019-04-20T17:59:58.111900
Virgie
elmlang
general
Learn how to use elm-ui. I need recommendations on where to look for content.
2019-04-20T18:19:04.112100
Sandi
elmlang
general
there is a <#C4F9NBLR1|elm-ui> channel for questions, and an examples folder in the repo <https://github.com/mdgriffith/elm-ui/tree/master/examples>
2019-04-20T18:26:57.112900
Virgie
elmlang
general
Thanks for your help. I'm going to read it now
2019-04-20T18:31:05.113100
Sandi
elmlang
general
Also of interest is this talk from the author of elm-ui: <https://www.youtube.com/watch?v=Ie-gqwSHQr0>
2019-04-20T18:36:25.113500
Carman
elmlang
general
I've been meaning to PR the tuple bits to the main library, but I think there's some better was to handle this stuff now so I haven't bothered upgrading the library.
2019-04-21T02:27:32.114600
Myrtle
elmlang
general
The package docs are great too
2019-04-21T03:59:53.115500
Bebe
elmlang
general
Any suggestions on how I can builder a decoder of `Int` that does not succeed in this case ``` &gt; Decode.decodeString <http://Decode.int|Decode.int> "2.0" Ok 2 : Result Decode.Error Int ```
2019-04-21T04:36:11.116200
Lynn
elmlang
general
JSON only has `number` and doesn't disambiguate between floats and integers, so as far as JSON (and JS) are concerned, that's _exactly_ the same as json with `2`. In other words, I can't really think of a way of handling this that doesn't involve manually parsing the actual json string
2019-04-21T04:39:36.116500
Huong
elmlang
general
Or to explain it slightly differently - Elm internally uses `JSON.parse(jsonString)` because it's much more efficient to do that than to implement a custom parser. The issue in this case is that, on the resulting value, there is - as far as I can think of - no way to say whether the original JSON string specified `2.0` or just `2`
2019-04-21T04:43:14.116700
Huong
elmlang
general
(i.e. in JS, `2.0 === 2`)
2019-04-21T04:44:40.116900
Huong
elmlang
general
so to disambiguate, it would have to happen during parsing rather than during decoding, which we currently do not control
2019-04-21T04:45:28.117100
Huong
elmlang
general
Decode it as a string, andThen call toInt maybe?
2019-04-21T04:56:15.117800
Danika
elmlang
general
`Decode.string` only works on things that are actually a string _in the JSON_. That was my first thought, too, but it wouldn't work :smile:
2019-04-21T05:00:34.118000
Huong
elmlang
general
it's somewhat easier to see if we adapt the original example to `Decode.decodeString (Decode.field "foo" <http://Decode.int|Decode.int>) "{\"foo\": 2.0}"`
2019-04-21T05:02:07.118300
Huong
elmlang
general
Hmm
2019-04-21T05:02:56.118800
Danika
elmlang
general
As soon as `JSON.parse` is used, you end up with this value `2.0` which is _exactly_ the same thing as `2` as far as javascript (and JSON!) goes
2019-04-21T05:04:23.119000
Huong
elmlang
general
ok. hoped I wasn't missing anything. I may need to add a tag to the serialised values then
2019-04-21T05:04:55.119200
Lynn
elmlang
general
Yeah, that's probably a good idea. Alternatively (but also icky) you could use `{"foo": "2.0"}` and interpret that string
2019-04-21T05:06:14.119400
Huong
elmlang
general
indeed, I can see that causing issues as I will use this decoder very generally
2019-04-21T05:07:24.119600
Lynn
elmlang
general
Does Elm use deep compare after an update to prevent rerenders? I've noticed it compares deeply when using (==), but I'm not sure if the VDom is written in Elm w/ kernel code or if it's entirely JS and uses something like shallow compare
2019-04-21T13:36:31.122500
Dayna
elmlang
general
I’m pretty sure it doesn’t do a deep compare.
2019-04-21T13:39:16.123100
Cornell
elmlang
general
I know `lazy` compares by reference, except for primitives like `String` and `Int`, which it will compare directly.
2019-04-21T13:40:08.123800
Cornell
elmlang
general
Though maybe it does :thinking_face: Im realizing now I don’t know
2019-04-21T13:46:05.125300
Cornell
elmlang
general
In the redux community, performance is a huge topic and usage of libraries like reselect is very common. It seems strange that even with escape hatches and many performance optimizations (no prop drilling like in Elm) people complain about Redux's performance, but I've never seen any performance complaints/solutions for Elm, is that because the community is still small?
2019-04-21T13:47:35.126400
Dayna
elmlang
general
Looks like the diff does use `===`: <https://github.com/elm/virtual-dom/blob/5a5bcf48720bc7d53461b3cd42a9f19f119c5503/src/Elm/Kernel/VirtualDom.js#L706>
2019-04-21T13:48:43.127000
Cornell
elmlang
general
I saw that piece of code too, but that's for diffing the DOM, I'm talking about the process before that - deciding if dom diffing is even needed
2019-04-21T13:49:22.128600
Dayna
elmlang
general
It could be that the DOM is always diff'd in Elm though, I'm not familiar with the implementation
2019-04-21T13:50:12.129800
Dayna
elmlang
general
The assumption of immutability in Elm allows the compiler and runtime to do most of the optimizations that you need to do by hand with Redux and React.
2019-04-21T13:50:47.130100
Lashawnda
elmlang
general
Also, deeply nested codepaths and data structures in Elm are intentionally difficult, and flatter code has lead to less expensive update function calls
2019-04-21T13:52:31.132300
Lashawnda
elmlang
general
I guess so, but derived data will still create new references
2019-04-21T13:56:19.135300
Dayna
elmlang
general
It tends not to matter. Even in the largest and most complicated programs we have at NoRedInk garbage collection is not a bottleneck.
2019-04-21T13:57:39.137000
Lashawnda
elmlang
general
I'm not talking about GC, I'm talking about derived data like List.filter/map etc always producing a new reference even though the contents might be the same.
2019-04-21T13:58:42.137600
Dayna
elmlang
general
As far as I understand lazy would skip diffing a subtree
2019-04-21T13:59:31.138500
Dorotha
elmlang
general
For example, you can run a selector that uses List.map 5 times using the same model and it will produce 5 list references that have the same contents, but if you use shallow compare it will seem like 5 changes have happened, it's a huge issue when writing redux apps and that's why libraries like reselect exist.
2019-04-21T13:59:45.138700
Dayna
elmlang
general
Oh I see. I’m not sure why that isn’t a big issue here. `Html.Lazy` exists for this, but there’s no data to tell us how often it is used
2019-04-21T14:04:18.141300
Lashawnda
elmlang
general
So with <https://www.youtube.com/watch?v=XpDsk374LDE> (Elm Europe 2017 - Evan Czaplicki - The life of a file) in mind. Got some modules that are becoming quite a pain to navigate, but I don't want to split out certain groups of functions into another module because I don't want to expose the `Msg` and `Model` that these functions would work on. Started plopping these in as a way to sort of have sub modules within my modules. ``` {-| _____ _ | ___| ___ ___ | |__ __ _ _ __ | |_ / _ \ / _ \ | '_ \ / _` | | '__| | _| | (_) | | (_) | | |_) | | (_| | | | |_| \___/ \___/ |_.__/ \__,_| |_| -} gotoFoobar : () gotoFoobar = () ``` So I get a visual delimiter when scrolling (readable in minimaps as well) and a symbol with a common prefix to jump to. Quite interested what everyone else is doing for large modules in their codebases.
2019-04-22T00:12:02.145900
Lizabeth
elmlang
general
Lots of people have the classic ``` {--------------- Model ---------------} ``` banners. But if your module is getting hard to navigate then better tooling might help
2019-04-22T00:53:07.146600
Earlean
elmlang
general
The Elm add-ons for most editors includes features like 'go to definition' or 'peek definition' that provide a way to find functions you're using
2019-04-22T00:55:46.146800
Earlean
elmlang
general
Trying to find an approach that isn't dependant on a specific editor. The useless `gotoFoobar` function is simply there to leverage existing 'go to definition' of most editors. I suppose grouping functions with a common prefix would work too.
2019-04-22T01:03:28.147000
Lizabeth
elmlang
general
I’ve been unable to find any information about such a feature but what I want is to be able tell my editor to represent a big file as several smaller files.
2019-04-22T01:16:33.147300
Jae
elmlang
general
So I’d be able to define a new file that starts at line 500 and ends at line 1500. Then if I made changes in this virtual file, it would be inserted into the original file
2019-04-22T01:18:36.147500
Jae
elmlang
general
I just put a ``` -- MODEL -- UPDATE -- VIEW ``` and search for the uppercase names
2019-04-22T04:43:10.148000
Earnest
elmlang
general
I think vscode has bookmarks. I'm not sure, I'll check it out and will report back.
2019-04-22T04:54:55.148400
Lory
elmlang
general
Hello, I am using em-verify-examples to test a function that returns a float. I am getting the following message ` Do not use Expect.equal with floats. Use Float.within instead.` What can I do about it?
2019-04-22T05:06:29.148700
Ayesha
elmlang
general
You cannot really test for equality with float, due to rounding errors
2019-04-22T05:13:18.148800
Hoa
elmlang
general
I’m wondering if the error is referring to this function: <https://package.elm-lang.org/packages/ianmackenzie/elm-float-extra/1.0.1/Float-Extra#equalWithin>
2019-04-22T05:14:03.149000
Hoa
elmlang
general
So is it really `equalWithin`?
2019-04-22T05:15:14.149200
Hoa