-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task requests and tracking progress #61
Comments
Here’s a use case. I made a function that first asks my API for an AWS S3 signed URL, and then uploads a file to that signed URL (using |
Use case 2: I wanted a waitAtLeast : Int -> Task x a -> Task x a
waitAtLeast delay task =
-- Sure would be nice to have do notation here
-- do
-- start <- Time.now
-- value <- task
-- end <- Time.now
-- let toWait = end - start - delay
-- . . .
-- desugared into:
Time.now
|> Task.andThen
(\start ->
task
|> Task.andThen
(\value ->
Time.now
|> Task.andThen
(\end ->
let
toWait : Int
toWait =
delay
- Time.posixToMillis end
+ Time.posixToMillis start
in
if toWait <= 0 then
Task.succeed value
else
Process.sleep (toFloat toWait)
|> Task.andThen (\_ -> Task.succeed value)
)
)
) Turning a |
@evancz ? |
Is there a reason Task requests don't accept the
tracker
field to track progress?https://package.elm-lang.org/packages/elm/http/latest/Http#task
compare to
https://package.elm-lang.org/packages/elm/http/latest/Http#request
The text was updated successfully, but these errors were encountered: