Last active
June 8, 2024 14:29
-
-
Save dasch/41ffee16e167fb33b68c0b799a22cf38 to your computer and use it in GitHub Desktop.
Elm / Roc like language; pure, functional, statically typed, lazy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Http | |
import File | |
import Url | |
download : String -> Task () (HttpError Http.Error | FileError File.Error) | |
download = url -> | |
content <- Http.getBytes url | |
filename = Url.path url | |
|> String.split "/" | |
|> List.last | |
|> Result.withDefault "data" | |
File.write filename content |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Perform the list of tasks in parallel, returning a list of the resulting values. | |
# If any of the tasks fail, the entire sequence will fail. | |
Task.parallel : List (Task a err) -> Task (List a) err | |
# Perform the list of tasks sequentially, returning a list of the resulting values. | |
# If any of the tasks fail, the entire sequence will fail. | |
Task.sequential : List (Task a err) -> Task (List a) err | |
Task.join : Task a err1 -> Task b err2 -> Task (a, b) (err1 | err2) | |
Task.join3 : Task a err1 -> Task b err2 -> Task c err3 -> Task (a, b, c) (err1 | err2 | err3) | |
Task.andThen : (a -> Task b err2) -> Task a err1 -> Task b (err1 | err2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment