Skip to content
Brian Marick edited this page Nov 15, 2017 · 1 revision

Full source

upsert2 : (big -> Maybe small)
        -> (Maybe small -> big -> big)
        -> Upsert big small
upsert2 get set =
  let
    update f big = 
      case get big of
        Nothing ->
          big
        Just small ->
          set (Just <| f small) big
  in
    Tagged { get = get, set = set, update = update }

Clone this wiki locally