Reputation: 7186
At the moment, if I try to do this inside a handler:
newPerson <- runDB $ update personId [PersonAge =. 27]
newPerson
will have the type ()
. It seems that update
doesn't yield any value, so if I want to get the updated entity, I need to do this:
newPerson <- runDB $ do
update personId [PersonAge =. 27]
get personId
Which results in newPerson
having type Maybe Person
, and some additional code to handle the Nothing
case (or using fromJust
). Is there a way to bypass the issue? Should there be? To me it makes sense for update
to return the updated record, but should it really?
Upvotes: 0
Views: 560