refactor RelationalError to be ADT
implement relation variable type safety