From 00bcb72b8b967cedcd9d873ba44b44f1b37f3bf0 Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Mon, 19 Oct 2020 22:21:03 -0700 Subject: [PATCH] Remove redundant function calls to improve performance. --- src/Pages/StaticHttp.elm | 42 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/src/Pages/StaticHttp.elm b/src/Pages/StaticHttp.elm index fc4278ef..05188440 100644 --- a/src/Pages/StaticHttp.elm +++ b/src/Pages/StaticHttp.elm @@ -266,44 +266,22 @@ map2 fn request1 request2 = Request ( urls1 , \appType rawResponses -> - let - value1 = - lookupFn1 appType rawResponses - |> Result.map Tuple.second - - dict1 = - lookupFn1 appType rawResponses - |> Result.map Tuple.first - |> Result.withDefault Dict.empty - in - Result.map2 - (\thing1 thing2 -> - ( dict1, map2 fn thing1 thing2 ) - ) - value1 - (Ok (Done value2)) + lookupFn1 appType rawResponses + |> Result.map + (\( dict1, value1 ) -> + ( dict1, map2 fn value1 (Done value2) ) + ) ) ( Done value2, Request ( urls1, lookupFn1 ) ) -> Request ( urls1 , \appType rawResponses -> - let - value1 = - lookupFn1 appType rawResponses - |> Result.map Tuple.second - - dict1 = - lookupFn1 appType rawResponses - |> Result.map Tuple.first - |> Result.withDefault Dict.empty - in - Result.map2 - (\thing1 thing2 -> - ( dict1, map2 fn thing1 thing2 ) - ) - (Ok (Done value2)) - value1 + lookupFn1 appType rawResponses + |> Result.map + (\( dict1, value1 ) -> + ( dict1, map2 fn (Done value2) value1 ) + ) ) ( Done value1, Done value2 ) ->