handleViolations
  :: (Connection -> IO a)
  -> Connection
  -> IO (Maybe a)
handleViolations fn cn = catchViolation catcher (Just <$> fn cn)
  where
    catcher _ (UniqueViolation _) = return Nothing
    catcher e _                   = throwIO e
handleViolations
  :: (Connection -> IO a)
  -> Connection
  -> IO (Maybe a)
handleViolations fn cn = catchViolation catcher (Just <$> fn cn)
  where
    catcher _ (UniqueViolation _) = return Nothing
    catcher e _                   = throwIO e
handleViolations fn cn = catchViolation catcher (Just <$> fn cn)
  where
    catcher _ (UniqueViolation _) = return Nothing
    catcher e _                   = throwIO e