{"id":20537932,"url":"https://github.com/dmjio/tstack","last_synced_at":"2025-09-25T15:32:19.042Z","repository":{"id":146242426,"uuid":"157782076","full_name":"dmjio/tstack","owner":"dmjio","description":"A concurrent, thread-safe, transactional stack","archived":false,"fork":false,"pushed_at":"2024-12-14T01:03:43.000Z","size":393,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-07T13:39:07.880Z","etag":null,"topics":["haskell","stack","stm"],"latest_commit_sha":null,"homepage":"","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/dmjio.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","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}},"created_at":"2018-11-15T22:45:14.000Z","updated_at":"2024-12-14T01:03:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"af73b7c1-5513-487c-ae80-da6cb91dc0fc","html_url":"https://github.com/dmjio/tstack","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dmjio/tstack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmjio%2Ftstack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmjio%2Ftstack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmjio%2Ftstack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmjio%2Ftstack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmjio","download_url":"https://codeload.github.com/dmjio/tstack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmjio%2Ftstack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276940324,"owners_count":25732289,"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-09-25T02:00:09.612Z","response_time":80,"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":["haskell","stack","stm"],"created_at":"2024-11-16T00:43:28.518Z","updated_at":"2025-09-25T15:32:18.706Z","avatar_url":"https://github.com/dmjio.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tstack\nA concurrent, thread-safe, transactional Stack\n\n### Build\n```\nnix-build\n```\n\n### Develop\n```\n$ nix-shell --command 'runghc Setup.hs build'\n```\n\n### Example\n```haskell\nmodule Main where\n\nimport Control.Monad\nimport Control.Concurrent\nimport Control.Concurrent.STM\nimport Control.Concurrent.STM.TStack\n\nimport GHC.Conc\n\n-- | This example illustrates GHC's\n-- fairness policy, and models the\n-- \"hungry-hungry hippos\" model of\n-- concurrent consumption\nmain :: IO ()\nmain = do\n  tstack \u003c- newTStack\n  forkIO . forever . void $ do\n    -- Will block until we get an item\n    item \u003c- atomically (pop tstack)\n    showThread\n    putStrLn $ \"You entered: \" \u003c\u003e item\n  forkIO . forever . void $ do\n    -- Will block until we get an item\n    item \u003c- atomically (pop tstack)\n    showThread\n    putStrLn $ \"You entered: \" \u003c\u003e item\n  forever $ do\n    line \u003c- getLine\n    -- Will push an item when we get it\n    atomically (push line tstack)\n      where\n        showThread = do\n          tid \u003c- myThreadId\n          putStrLn $ \"Printed by Thread: \" \u003c\u003e show tid\n```\n\n### Result\n```bash\n$ nix-build \u0026\u0026 ./result/bin/example +RTS -N\na\nPrinted by Thread: ThreadId 2\nYou entered: a\nb\nPrinted by Thread: ThreadId 3\nYou entered: b\nc\nPrinted by Thread: ThreadId 2\nYou entered: c\nd\nPrinted by Thread: ThreadId 3\nYou entered: d\ne\nPrinted by Thread: ThreadId 2\nYou entered: e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmjio%2Ftstack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmjio%2Ftstack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmjio%2Ftstack/lists"}