{"id":21467927,"url":"https://github.com/danr/stm-promise","last_synced_at":"2025-03-17T06:13:46.331Z","repository":{"id":6586533,"uuid":"7828962","full_name":"danr/stm-promise","owner":"danr","description":"Simple STM promise-like thingys","archived":false,"fork":false,"pushed_at":"2018-03-12T08:08:04.000Z","size":2068,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-03-15T12:26:17.010Z","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":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danr.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}},"created_at":"2013-01-25T21:33:19.000Z","updated_at":"2019-12-22T00:54:40.000Z","dependencies_parsed_at":"2022-09-13T19:14:24.736Z","dependency_job_id":null,"html_url":"https://github.com/danr/stm-promise","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danr%2Fstm-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danr%2Fstm-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danr%2Fstm-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danr%2Fstm-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danr","download_url":"https://codeload.github.com/danr/stm-promise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243982296,"owners_count":20378606,"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","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":"2024-11-23T08:20:39.956Z","updated_at":"2025-03-17T06:13:46.303Z","avatar_url":"https://github.com/danr.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"### STM Promises\n\n[![Build Status](https://travis-ci.org/danr/stm-promise.png?branch=master)](https://travis-ci.org/danr/stm-promise)\n\n# An example\n\nRunning the theorem prover eprover in parallel:\n\n    import Prelude hiding (mapM)\n    import Data.Traversable\n\n    import Data.List\n    import Data.Maybe\n\n    import Control.Concurrent.STM.Promise\n    import Control.Concurrent.STM.Promise.Process\n    import Control.Concurrent.STM.Promise.Tree\n    import Control.Concurrent.STM.Promise.Workers\n\n    {- | A tree for this file structure:\n       ├── mul-commutative\n       │   ├── induction_x_0.tptp\n       │   ├── induction_x_1.tptp\n       │   ├── induction_x_y_0.tptp\n       │   ├── induction_x_y_1.tptp\n       │   ├── induction_x_y_2.tptp\n       │   ├── induction_x_y_3.tptp\n       │   ├── induction_y_0.tptp\n       │   ├── induction_y_1.tptp\n       │   └── no_induction_0.tptp\n       └── plus-commutative\n           ├── induction_x_0.tptp\n           ├── induction_x_1.tptp\n           ├── induction_x_y_0.tptp\n           ├── induction_x_y_1.tptp\n           ├── induction_x_y_2.tptp\n           ├── induction_x_y_3.tptp\n           ├── induction_y_0.tptp\n           ├── induction_y_1.tptp\n           └── no_induction_0.tptp\n    -}\n    file_tree :: Tree FilePath\n    file_tree = fmap (++ \".tptp\") $ tryAll\n       [ fmap (\"mul-commutative/\" ++) $ requireAny\n         [ fmap (\"induction_x_\" ++) $ requireAll $ map Leaf [\"0\",\"1\"]\n         , fmap (\"induction_y_\" ++) $ requireAll $ map Leaf [\"0\",\"1\"]\n         , fmap (\"induction_x_y_\" ++) $ requireAll $ map Leaf [\"0\",\"1\",\"2\",\"3\"]\n         , Leaf \"no_induction_0\"\n         ]\n       , fmap (\"plus-commutative/\" ++) $ requireAny\n         [ fmap (\"induction_x_\" ++) $ requireAll $ map Leaf [\"0\",\"1\"]\n         , fmap (\"induction_y_\" ++) $ requireAll $ map Leaf [\"0\",\"1\"]\n         , fmap (\"induction_x_y_\" ++) $ requireAll $ map Leaf [\"0\",\"1\",\"2\",\"3\"]\n         , Leaf \"no_induction_0\"\n         ]\n       ]\n\n    success :: ProcessResult -\u003e Bool\n    success r = excode r == ExitSuccess \u0026\u0026 any (`isInfixOf` stdout r) ok\n      where\n        ok = [\"Theorem\",\"Unsatisfiable\"]\n\n    eproverPromise :: FilePath -\u003e IO (Promise [(FilePath,Bool)])\n    eproverPromise file = do\n        let args = [\"-xAuto\",\"-tAuto\",'-':\"-tptp3-format\",\"-s\"]\n        promise \u003c- processPromise \"eprover\" (file : args) \"\"\n        let chres :: ProcessResult -\u003e [(FilePath,Bool)]\n            chres r = [ (file,success r) ]\n        return $ fmap chres promise\n\n    main :: IO ()\n    main = do\n        promise_tree \u003c- mapM eproverPromise file_tree\n\n        let timeout      = 1000 * 1000 -- microseconds\n            processes    = 2\n\n        workers (Just timeout) processes (interleave promise_tree)\n\n        res \u003c- evalTree (any (not . snd)) promise_tree\n\n        putStrLn \"Results: \"\n\n        mapM_ print res\n\nThe result of this run is:\n\n    Results:\n    (\"plus-commutative/induction_x_y_0.tptp\",True)\n    (\"plus-commutative/induction_x_y_1.tptp\",True)\n    (\"plus-commutative/induction_x_y_2.tptp\",True)\n    (\"plus-commutative/induction_x_y_3.tptp\",True)\n\nThis means that four out of four obligations for commutativity of plus\nsucceeded when doing induction on both x and y.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanr%2Fstm-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanr%2Fstm-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanr%2Fstm-promise/lists"}