Effect CommunityEC
Effect Community3y ago
21 replies
johannes

Issue with `.tap` method in effect-ts compared to `chainFirst` in fp-ts

Hi and thanks for a great library. I am facing a type issue with the .tap method. I used fp-ts before and saw on discord that .tap is equivalent in effect-ts to chainFirst in fp-ts.

I have the following code snippet:

export const deleteInterviewUseCase = (dto: DeleteInterviewDto) =>
    pipe(
        InterviewRepository,
        Effect.flatMap(({ getById, save }) =>
            pipe(
                getById(dto.interviewId),
                Effect.flatMap(deleteInterview),
                Effect.tap(save),
                Effect.flatMap(createInterviewDeletedEvent)
            )
        )
    );
Was this page helpful?