formatting

This commit is contained in:
Folkert 2022-01-19 23:56:14 +01:00
parent ee4c2177c0
commit a2cb9035c4
2 changed files with 36 additions and 16 deletions

View File

@ -6,12 +6,16 @@ Task ok err : Effect.Effect (Result ok err)
forever : Task val err -> Task * err
forever = \task ->
looper = \{} ->
looper = \{ } ->
task
|> Effect.map \res ->
|> Effect.map
\res ->
when res is
Ok _ -> Step {}
Err e -> Done (Err e)
Ok _ ->
Step {}
Err e ->
Done (Err e)
Effect.loop {} looper
@ -19,11 +23,17 @@ loop : state, (state -> Task [ Step state, Done done ] err) -> Task done err
loop = \state, step ->
looper = \current ->
step current
|> Effect.map \res ->
|> Effect.map
\res ->
when res is
Ok (Step newState) -> Step newState
Ok (Done result) -> Done (Ok result)
Err e -> Done (Err e)
Ok (Step newState) ->
Step newState
Ok (Done result) ->
Done (Ok result)
Err e ->
Done (Err e)
Effect.loop state looper

View File

@ -6,12 +6,16 @@ Task ok err : Effect.Effect (Result ok err)
forever : Task val err -> Task * err
forever = \task ->
looper = \{} ->
looper = \{ } ->
task
|> Effect.map \res ->
|> Effect.map
\res ->
when res is
Ok _ -> Step {}
Err e -> Done (Err e)
Ok _ ->
Step {}
Err e ->
Done (Err e)
Effect.loop {} looper
@ -19,11 +23,17 @@ loop : state, (state -> Task [ Step state, Done done ] err) -> Task done err
loop = \state, step ->
looper = \current ->
step current
|> Effect.map \res ->
|> Effect.map
\res ->
when res is
Ok (Step newState) -> Step newState
Ok (Done result) -> Done (Ok result)
Err e -> Done (Err e)
Ok (Step newState) ->
Step newState
Ok (Done result) ->
Done (Ok result)
Err e ->
Done (Err e)
Effect.loop state looper