{"id":30596443,"url":"https://github.com/simre1/multitasking","last_synced_at":"2025-08-29T21:43:43.091Z","repository":{"id":297672565,"uuid":"997044244","full_name":"Simre1/multitasking","owner":"Simre1","description":"Easy concurrency in Haskell","archived":false,"fork":false,"pushed_at":"2025-07-03T15:58:10.000Z","size":43,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-22T00:03:07.302Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Simre1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-05T21:35:35.000Z","updated_at":"2025-07-14T20:46:08.000Z","dependencies_parsed_at":"2025-06-06T19:27:07.613Z","dependency_job_id":"9fe69061-6f73-4110-964e-59bd4ff0d752","html_url":"https://github.com/Simre1/multitasking","commit_stats":null,"previous_names":["simre1/conio","simre1/multitasking"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Simre1/multitasking","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simre1%2Fmultitasking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simre1%2Fmultitasking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simre1%2Fmultitasking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simre1%2Fmultitasking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Simre1","download_url":"https://codeload.github.com/Simre1/multitasking/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simre1%2Fmultitasking/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272767607,"owners_count":24989534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-29T02:00:10.610Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-29T21:43:42.018Z","updated_at":"2025-08-29T21:43:43.077Z","avatar_url":"https://github.com/Simre1.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multitasking\n\nHaskell has great tools for dealing with concurrency. However, in praxis they are difficult to use.\n\nThis library aims to make concurrency easy by providing many built-in solutions for common concurrency patterns.\nIt is based on [structured concurrency](https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful), not letting threads outlive their parent scope. Additionally, exceptions are propagated automatically. This means that you do not have to worry about:\n\n- Ghost processes, since a thread can never outlive its parent scope.\n- Dead processes, since exceptions will propagate to the parent thread.\n\n\n## Examples\n\n```haskell\nawaitAllExample :: IO ()\nawaitAllExample =\n  -- open up a concurrency scope\n  multitask $ \\coordinator -\u003e do\n    -- launch tasks\n    task1 \u003c- start coordinator action1\n    task2 \u003c- start coordinator action2\n    -- Wait for all actions to complete\n    await coordinator\n```\n\n```haskell\nawaitTaskExample :: IO ()\nawaitTaskExample =\n  -- open up a concurrency scope\n  multitask $ \\coordinator -\u003e do\n    -- start task\n    task \u003c- start coordinator $ pure 10\n    \n    -- do some work\n    let x = 10\n\n    -- wait for task to complete and get the result\n    result \u003c- await task\n\n    -- prints 20\n    print $ x + result\n```\n\n```haskell\nraceTasksExample :: IO ()\nraceTasksExample = multitask $ \\coordinator -\u003e\n  slot \u003c- newSlot\n  _ \u003c- start coordinator $ action1 \u003e\u003e= putSlot slot\n  _ \u003c- start coordinator $ action2 \u003e\u003e= putSlot slot\n  result \u003c- awaitSlot slot\n  print result\n```\n\n```haskell\nbuiltinRaceExample :: IO ()\nbuiltinRaceExample = do\n    result \u003c- raceTwo (threadDelay 1000000 \u003e\u003e pure 10) (pure 20)\n    print result\n```\n\n## Comparison with other libraries\n\n- `ki`: Implements structured concurrency, but provides no high-level functionality. `multitasking` uses `ki` internally and additionally implements commonly used patterns. \n- `async`: Does not implement structured concurrency\n\n## Acknowledgements\n\n- Inspired by [Notes on structured concurrency](https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful), which is implemented in the `trio` Python library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimre1%2Fmultitasking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimre1%2Fmultitasking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimre1%2Fmultitasking/lists"}