This should probably raise `TypeError` or something if #to_hash fails