If you can find a good way to divide things into chunks then Process.sleep 0
should get you what you’re looking for. This should allow other events that the browser has backlogged during parsing to be processed before moving on to the next chunk.
loadData
|> Task.map splitData
|> Task.andThen
(List.foldl
(\chunk previous ->
Process.sleep 0
|> Task.andThen (\_ -> previous)
|> Task.map (\alreadyParsed -> parsed ++ parse chunk)
)
(Task.succeed [])
)