Skip to content

Instantly share code, notes, and snippets.

@the-frey
Created November 27, 2020 14:14
Show Gist options
  • Select an option

  • Save the-frey/668335eee9910c6e4a6b8d396e033945 to your computer and use it in GitHub Desktop.

Select an option

Save the-frey/668335eee9910c6e4a6b8d396e033945 to your computer and use it in GitHub Desktop.
const pipeline = pipe(
TE.fromEither(getIdFromPath(event)), // start a pipe of TaskEither
TE.chain(uid => getUser(client, uid)),
TE.chainEitherK(getUserFromRes), // chainEitherK: <E, A, B>(f: (a: A) => E.Either<E, B>) => (ma: TaskEither<E, A>) => TaskEither<E, B>
TE.chainEitherK(userToSharable),
TE.map(userWithoutPII => responses.respond200('<your-project>/user', userWithoutPII)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment