-- 비동기 결과와 오류를 튜플로 — try…catch 대신
tuple :: IO a -> IO (Either Error a)
tuple p = (Right <$> p) `catch` (pure . Left . wrap)
where wrap e | isError e = e
| otherwise = TupleItError e -- Error 가 아닌 값으로 reject 돼도 감싼다
-- const [error, data] = await tuple(someAsyncFunction())
-- 성공 [null, data] · 실패 [error] — if (error) 하나로 갈린다
-- 언어 문법으로 넣자는 제안: safe assignment operator (?=)