Created
August 13, 2017 14:38
-
-
Save aspnetde/f5ccb902b620322bb009e18261cb01cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
Thanks guys. I will have a chat with my Rider configuration, which doesn't seem to like this kind of indentation, which brought the question up in the first place.
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
Similar to both the above I guess.
I've made a couple of small "compressions" to the code but they are just personal preference e.g. replace match with function. I'd advise avoiding use of binding to the name
id
as it's a built-in function in F# and might confuse.