mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-23 11:55:41 +03:00
Refactor as a step for tail call optimization.
This commit is contained in:
parent
f595605f4d
commit
83eb90aa9f
@ -144,14 +144,11 @@ map fn requestInfo =
|
|||||||
Request partiallyStripped
|
Request partiallyStripped
|
||||||
( urls
|
( urls
|
||||||
, \appType rawResponses ->
|
, \appType rawResponses ->
|
||||||
lookupFn appType rawResponses
|
map fn (lookupFn appType rawResponses)
|
||||||
|> (\nextRequest ->
|
|
||||||
map fn nextRequest
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Done stripped value ->
|
Done stripped value ->
|
||||||
fn value |> Done stripped
|
Done stripped (fn value)
|
||||||
|
|
||||||
|
|
||||||
{-| Helper to remove an inner layer of Request wrapping.
|
{-| Helper to remove an inner layer of Request wrapping.
|
||||||
@ -233,16 +230,12 @@ map2 fn request1 request2 =
|
|||||||
RequestError error
|
RequestError error
|
||||||
|
|
||||||
( Request newDict1 ( urls1, lookupFn1 ), Request newDict2 ( urls2, lookupFn2 ) ) ->
|
( Request newDict1 ( urls1, lookupFn1 ), Request newDict2 ( urls2, lookupFn2 ) ) ->
|
||||||
let
|
Request (combineReducedDicts newDict1 newDict2)
|
||||||
value : ApplicationType -> RequestsAndPending -> DataSource c
|
( urls1 ++ urls2
|
||||||
value appType rawResponses =
|
, \appType rawResponses ->
|
||||||
case ( lookupFn1 appType rawResponses, lookupFn2 appType rawResponses ) of
|
case ( lookupFn1 appType rawResponses, lookupFn2 appType rawResponses ) of
|
||||||
( newValue1, newValue2 ) ->
|
( newValue1, newValue2 ) ->
|
||||||
map2 fn newValue1 newValue2
|
map2 fn newValue1 newValue2
|
||||||
in
|
|
||||||
Request (combineReducedDicts newDict1 newDict2)
|
|
||||||
( urls1 ++ urls2
|
|
||||||
, value
|
|
||||||
)
|
)
|
||||||
|
|
||||||
( Request dict1 ( urls1, lookupFn1 ), Done stripped2 value2 ) ->
|
( Request dict1 ( urls1, lookupFn1 ), Done stripped2 value2 ) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user