Skip to content

Instantly share code, notes, and snippets.

@stijnmoreels
Created February 22, 2024 09:15
Show Gist options
  • Save stijnmoreels/fccc90952028fd966f97a556d8e8bf88 to your computer and use it in GitHub Desktop.
Save stijnmoreels/fccc90952028fd966f97a556d8e8bf88 to your computer and use it in GitHub Desktop.
// Guest -> GuestList -> ValidationResult<GuestList>
let add guest list =
Optic.map guests_ (fun gs -> g :: gs)
// Guest -> GuestList -> ValidationResult<GuestList>
let remove guest list =
Optic.get (guest_ guest.Name) list
>>= fun g -> Optic.map guests_ (List.except [g]) list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment