-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
["Request"] Bind unary values for Nel #3048
Comments
It would be convenient to do the same with |
@CLOVIS-AI what if we use the extension function instead? i.e. ensure(...) {
Failure.A().nel()
} Just my opinion, I think I would prefer to make |
What version are you currently using?
1.2.0-RC
What would you like to see?
Sometimes, inside
Raise<Nel<E>>
, a failed precondition stops the computation from going further, and short-circuiting is necessary.Let's image a recursive tree. A node is valid if it satisfies the predicate
a()
, and all its children satisfy it as well. I'm writing this example with context receivers for readability, but it is already the case now.When there are multiple short-circuiting operations, writing
ensure() { nonEmptyListOf() }
is inconvenient and makes the code more complicated. Instead, the library could provide a variant ofensure
andensureNotNull
that encapsulates this behavior:As a bonus, what about a
RaiseNel
type alias?The text was updated successfully, but these errors were encountered: