Skip to content

Instantly share code, notes, and snippets.

@aspnetde
Created August 13, 2017 14:38
Show Gist options
  • Save aspnetde/f5ccb902b620322bb009e18261cb01cf to your computer and use it in GitHub Desktop.
Save aspnetde/f5ccb902b620322bb009e18261cb01cf to your computer and use it in GitHub Desktop.
namespace Foo
module Bar =
let RelationsReducer (state:RelationState) action =
match action with
| ActivitiesRequestSucceeded (id, items)
-> { state with FacilityActivity = state.FacilityActivity |> Array.filter (fun (f, _) -> f <> id)
|> Array.append (items |> Array.map (fun item -> (id, item.Id))) }
| _ -> state
@yawaramin
Copy link

Extract variable:

match action with
  | ActivitiesRequestSucceeded (id, items) ->
    let facilityActivity =
      state.FacilityActivity
        |> Array.filter (fun (f, _) -> f <> id)
        |> Array.append (items |> Array.map (fun item -> (id, item.Id)))

      { state with FacilityActivity = facilityActivity }
  | _ -> state

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment