import ConcurrentTask as CT exposing (ConcurrentTask)
andThenDoOnlyIf : Bool -> ConcurrentTask Error () -> ConcurrentTask Error () -> ConcurrentTask Error ()
andThenDoOnlyIf shouldProcessTask secondTask firstTask =
firstTask
|> CT.andThenDo
(if shouldProcessTask then
secondTask
else
CT.succeed ()
)
andThenDoOnlyIf : Bool -> ConcurrentTask Error () -> ConcurrentTask Error () -> ConcurrentTask Error ()
andThenDoOnlyIf shouldProcessTask secondTask firstTask =
if shouldProcessTask then
firstTask |> CT.andThenDo secondTask
else
CT.succeed ()
The first one does work, the second doesn't execute its second task. Why does the first one work when the if-else is inside the CT.andThenDo function? Any Idea why that is?