Skip to content
This repository has been archived by the owner on Aug 23, 2018. It is now read-only.

Commit

Permalink
re-parenthesize task chains
Browse files Browse the repository at this point in the history
  • Loading branch information
vilterp committed Jul 31, 2015
1 parent 314fa5f commit 2bff271
Showing 1 changed file with 48 additions and 46 deletions.
94 changes: 48 additions & 46 deletions frontend/Debugger/RuntimeApi.elm
Original file line number Diff line number Diff line change
Expand Up @@ -173,62 +173,64 @@ swap : DebugSession
-> (SGShape -> List NodeId)
-> Task SwapError DebugSession
swap session newMod initialNodesFun =
(((dispose session)
(dispose session)
`Task.andThen` (\_ ->
getInputHistory session
))
`Task.andThen` (\history ->
initializeFullscreen
newMod
history
(getAddress session)
initialNodesFun
|> Task.map (\(newSession, _) -> (newSession, history))
))
`Task.andThen` (\(newSession, history) ->
let
nodes =
initialNodesFun (sgShape newSession)

valid =
validate history (sgShape session) (sgShape newSession)
in
case valid of
Just swapErr ->
Task.fail swapErr

Nothing ->
Task.succeed newSession
(getInputHistory session)
`Task.andThen` (\history ->
(initializeFullscreen
newMod
history
(getAddress session)
initialNodesFun
)
`Task.andThen` (\(newSession, _) ->
let
nodes =
initialNodesFun (sgShape newSession)

valid =
validate history (sgShape session) (sgShape newSession)
in
case valid of
Just swapErr ->
Task.fail swapErr

Nothing ->
Task.succeed newSession
)
)
)


forkFrom : DebugSession
-> FrameIndex
-> Task x (DebugSession, ValueSet)
forkFrom session frameIdx =
(((getSubscriptions session)
`Task.andThen` (\subs ->
getInputHistory session
|> Task.map (\history ->
( history |> splitInputHistory frameIdx |> fst
, subs
(dispose session)
`Task.andThen` (\_ ->
(getSubscriptions session)
`Task.andThen` (\subs ->
(getInputHistory session
|> Task.map (\history ->
history |> splitInputHistory frameIdx |> fst)
)
`Task.andThen` (\historyUpTo ->
(initializeFullscreen
(getModule session)
historyUpTo
(getAddress session)
(always subs)
)
`Task.andThen` (\(newSession, _) ->
(getNodeStateSingle
newSession
frameIdx
subs
)
|> Task.map (\values -> (newSession, values))
)
))
`Task.andThen` (\(historyUpTo, subs) ->
initializeFullscreen
(getModule session)
historyUpTo
(getAddress session)
(always subs)
|> Task.map (\(session, values) -> (session, values, subs))
))
`Task.andThen` (\(newSession, values, subs) ->
getNodeStateSingle
newSession
frameIdx
subs
|> Task.map (\vals -> (newSession, vals))
)
)
)


Expand Down

0 comments on commit 2bff271

Please sign in to comment.