You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey everyone, I can't find documentation on how to update only Just values having several Maybe's.
Let's say user sent a request asking edit some of his profile fields:
editUser :: MonadSelda m => ID User -> Maybe Text -> Maybe Text -> Maybe Text -> m ()
editUser userId mbNewLogin mbNewPassword mbNewStatus =
update_
usersTable
(\user -> user ! #id .== literal userId)
(error "What do I do here?")
Perhaps we could replace the error line with something like this:
-- ?:= - is a hypothetical operator for working with Maybe's
(\user -> user `with`
[ #login ?:= literal <$> mbNewLogin,
#password ?:= literal <$> mbNewPassword,
#status ?:= literal <$> mbNewStatus ]
)
Do we have such a functionality in selda?
I wrote my own solution and can post it via pull request or comment, but I am pretty sure I am missing some obvious built-in way of doing this.
The text was updated successfully, but these errors were encountered:
Hey everyone, I can't find documentation on how to update only
Just
values having severalMaybe
's.Let's say user sent a request asking edit some of his profile fields:
Perhaps we could replace the error line with something like this:
Do we have such a functionality in
selda
?I wrote my own solution and can post it via pull request or comment, but I am pretty sure I am missing some obvious built-in way of doing this.
The text was updated successfully, but these errors were encountered: