returnCopy :: Bug -> String -> Connection -> IO (Maybe Int64)
returnCopy bug isbn_ = handleViolations (update templ isbn_)
  where
    templ = if bug == Bug
      then "UPDATE books SET available = available + 1 WHERE isbn = ?;"
      else "UPDATE books SET available = available + 1\
           \ WHERE isbn = ? AND available < owned;"
returnCopy :: Bug -> String -> Connection -> IO (Maybe Int64)
returnCopy bug isbn_ = handleViolations (update templ isbn_)
  where
    templ = if bug == Bug
      then "UPDATE books SET available = available + 1 WHERE isbn = ?;"
      else "UPDATE books SET available = available + 1\
           \ WHERE isbn = ? AND available < owned;"
returnCopy bug isbn_ = handleViolations (update templ isbn_)
  where
    templ = if bug == Bug
      then "UPDATE books SET available = available + 1 WHERE isbn = ?;"
      else "UPDATE books SET available = available + 1\
           \ WHERE isbn = ? AND available < owned;"