How to Write Simple, Clear F# Option Pipelines with Option.orElseWith

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 พ.ย. 2024

ความคิดเห็น • 2

  • @000dr0g
    @000dr0g 5 หลายเดือนก่อน +1

    Very nice. Less code is nearly always better code; when you know the helpers, your refactor is both more concise and clearer.

  • @gp5381
    @gp5381 4 หลายเดือนก่อน +1

    if you chain it with Option.map you get the best benefit! all your options can flow in pipes |> |>
    CREATE or receive OPTION --> MAP OPTION --> HANDLE NONE CASE (or else with or default),
    option are "containers" (also Result!), same as collections (list, seq, array), so they can be mapped, filtered, etc..