입력:23/01/26수정:24/02/07
do를 활용한 either
return pipe(
TE.Do,
TE.bind('guests', getGuests),
TE.bind('households', getHouseholds),
TE.map(({ guests, households }) => ({
guests: mapGuestsToDTO(guests),
households: mapHouseholdsToDTO(households),
})),
TE.chain(({ guests, households }) =>
pipe(InvitationList.create({ guests, households }), TE.fromEither),
),
TE.mapLeft(
(error: Error) =>
new Error(`Failed to find guest list: ${error.message}`),
),
);