Recursive references in library binding function body?
My mistake. Implemented a JS equivalent example but the signals library will throw Error: Cycle detected Even if you use signal.peek() in an untracked block, it will still throw that error. Looks like...
View ArticleRecursive references in library binding function body?
Often, facing the expressiveness limits of ReScript is a signal that I’m going to wrong way
View ArticleRescript frustration
i’m having trouble understanding this take. this happens to be part of the cli, but it could be anything else, let’s say network stream packet parsing where you want to be able to resume anyway. i...
View ArticleRescript frustration
I think result handling is definitely an area I think can be improved, but when faced with something like this I’d just use exceptions and hide it away in some kind of util function that does the...
View ArticleRescript frustration
I totally understand the appeal for sanity checks, guards, etc. What I’m saying is that you should generally aim at having the least complex type possible, so if you only care about the presence or...
View ArticleRescript frustration
help me understand this. the point of carrying around errors is you can handle them at the boundary and list them all, print them out with sane error messages instead of crashing hard. there might...
View ArticleRescript frustration
I’m not talking about crashing hard, you can fortunately catch exceptions and list and print out the sane error messages exactly at the same place as if you had used result: switch processRequest() {...
View ArticleRescript frustration
Carrying around Results or Options can feel odd at first, but once you understand the types it’s hard to not use them. This is a great talk about how to use ADTs to contain data and pass it along in a...
View ArticleRescript frustration
i’ve actualy seen that particular video before. no matter, i’m not sure who you’re talking to - i’m the guy promoting carrying results and options around in this discussion! :> @tsnobip help me...
View ArticleRescript frustration
Not really responding directly to anyone in particular, I just wanted to add some information to the thread for anyone who comes across it. I’ve been meaning to write up a blog post on using Railway...
View ArticleRescript frustration
I may not have expressed myself clearly, I fully support the use of results and options. In fact, I use them all the time and find them highly beneficial. I’m just saying that if there are some...
View ArticleRescript frustration
I am a fan of figuring out how to enable more complex FP patterns, but we should make sure that they aren’t the norm and we scare away JS devs. We want JS devs to like ReScript, but we should also...
View ArticleRescript frustration
tsnobip: I’m just saying that if there are some results you use only to short-circuit to their ok value and check the error cases only on the boundaries, it’s a smell you might be better off using a...
View ArticleRescript frustration
experimenting for a bit and the only conclusion i can sort of draw in the end is that exceptions are interesting ONLY because I cant do early returns. i dont understand why you’re saying the compiler...
View ArticleRescript frustration
My 2 cents, given you’re relatively new to rescript, if you feel like only wrong design decisions have been made, it’s likely that you’ve been writing non-idiomatic code and you’ve been fighting the...
View ArticleRescript frustration
i don’t mean to sound harsh, it just feels like an incomplete toolbox. could you help me distinguish between exceptions and results? coming from rust, i’m used to only doing results.
View ArticleRescript frustration
I find results work best when they work on the same type – something like validating a string in a form. For something like processing args in a CLI app, if you create some kind of context object to...
View ArticleRescript frustration
i have spent the entire weekend (yes, literally the entire weekend so far) rewriting the arg parser in 5-6 different iterations just to get a grasp on what would work, be readable and i guess...
View ArticleRescript frustration
xfcw: HOWEVER, the standard library does not facilitate railway oriented programming. this is why i ended up feeling “worst of both worlds”. i rolled my own, trivial micro-lib as a replacement for...
View ArticleRescript frustration
sure, i’d like to think i can: for option: let getOrElse = (opt, fn) => switch opt { | Some(val) => val | None => fn() } also repeat/reduce (see below): for result: let getOr = (res, err)...
View Article