0

I want to create function with this shape to fold an option

(option<A>) => ( fun: (<A>) => <B> ) => <B>

The code currently looks like this, but I have the feeling there's more idiomatic way to achieve the same

const stepIntrD = fu.pipe(
    lectureInteractionStats.children,
    option.fromNullable,
    option.chain(readonlyArray.findFirst<InteractionStatsData>((lis) => lis.id == step.id)),
    (v) => (fun: (_: InteractionStatsData) => boolean) => option.fold(() => false, fun)(v)
);
        
const wazVisited = stepIntrD(wasVisited);
Lauren Yim
  • 12,700
  • 2
  • 32
  • 59
gdanov
  • 312
  • 2
  • 12

0 Answers0