I'm trying to attempt an Aff computation. Consider the following code:
result <-
pool # withPool \connection -> do
execute_ ("insert into user (email, password) values ('"
<> unwrap userInfo.email <> "', '" <> unwrap userInfo.password <> "')")
connection
# attempt
The resulting Aff of attempt is later run using runAff.
Despite using attempt, the error in withPool is propagated to the error handler of runAff.
However, if parentheses are added around the Aff being attempted, the error is "caught" as expected:
result <-
(pool # withPool \connection -> do
execute_ ("insert into user (email, password) values ('"
<> unwrap userInfo.email <> "', '" <> unwrap userInfo.password <> "')")
connection)
# attempt
What am I missing here and why is the behavior of these two code snippets different?
The first snippet is equivalent to
and not