Using Effect's `pipe` with Options in fp-ts

Hey, folks. I'm an fp-ts dev looking to see if Effect can work for me (I think it does). I'm still having some issues understanding how to use Effect. Specifically, I use
pipe
in my fp-ts code and wanted to stick with it -- I like its conciseness. But I'm not understanding how to work with Options. For example, how would I achieve this code with Effect's
pipe
?

export const getPreviousElementSibling = (
  element: Element,
): O.Option<Element> => O.fromNullable(element.previousElementSibling);

... several more of these DOM functions that return an Option...

const getOpCode = (textArea: HTMLElement) => {
  return pipe(
    textArea.closest("tr"),
    O.fromNullable,
    O.chain(getPreviousElementSibling),
    O.chain(getNthChild("td", 4)),
    O.chain(getElementAttribute("title")),
    O.getOrElse(() => ""), // <-- if any Option is none, return ""
  );
};


With Effect, I'm not seeing any way that the Option.some is unwrapped to be used in my functions. Doing Option.flatMap((value) => {}) makes value be a wrapped Option<DomElement> .

What am I doing wrong?
Was this page helpful?