gcanti / monocle-ts

Functional optics: a (partial) porting of Scala monocle
https://gcanti.github.io/monocle-ts/
MIT License
1.05k stars 52 forks source link

add Refinement overload to findFirst #148

Closed wmaurer closed 3 years ago

wmaurer commented 3 years ago

The Refinement findFirst overload would be useful when dealing with arrays of union types. Right now the workaround is to folllow a findFirst with a filter:

    pipe(
        ...,
        O.findFirst(Vehicle.is.Bicycle),
        O.filter(Vehicle.is.Bicycle),
        ...
    )
gcanti commented 3 years ago

Thanks @wmaurer, released.