lastInsertRowId returns the identifier assigned to the most recently inserted row on a database connection. With an INTEGER PRIMARY KEY column, it returns the new row’s identifier. The sqlite-simple function has type Connection -> Int64, so convert its result to Int when the surrounding API uses Int. section 16.3.3
Returning the new todo identifier
After inserting a TodoEntry inside withTransaction, bind newIdx <- lastInsertRowId dbConn and return fromIntegral newIdx. Wrapping the action with try produces Either SQLError Int, allowing callers to handle database errors or use the created identifier. section 16.3.3
