{"id":24395286,"url":"https://github.com/heinrichapfelmus/operational","last_synced_at":"2025-04-06T17:13:06.983Z","repository":{"id":389697,"uuid":"2279021","full_name":"HeinrichApfelmus/operational","owner":"HeinrichApfelmus","description":"Implement monads by specifying instructions and their desired operational semantics.","archived":false,"fork":false,"pushed_at":"2024-05-21T14:25:22.000Z","size":76,"stargazers_count":83,"open_issues_count":3,"forks_count":16,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-31T12:57:59.444Z","etag":null,"topics":["free-monad","haskell","monad"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HeinrichApfelmus.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":"2011-08-27T12:07:16.000Z","updated_at":"2025-02-21T14:55:12.000Z","dependencies_parsed_at":"2024-06-18T22:58:17.295Z","dependency_job_id":"2060f8e0-c26f-4464-9428-74d9218cb594","html_url":"https://github.com/HeinrichApfelmus/operational","commit_stats":{"total_commits":62,"total_committers":12,"mean_commits":5.166666666666667,"dds":"0.25806451612903225","last_synced_commit":"597a561d07c77e32068eef2129982068ac8cceba"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HeinrichApfelmus%2Foperational","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HeinrichApfelmus%2Foperational/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HeinrichApfelmus%2Foperational/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HeinrichApfelmus%2Foperational/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HeinrichApfelmus","download_url":"https://codeload.github.com/HeinrichApfelmus/operational/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247517921,"owners_count":20951719,"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":["free-monad","haskell","monad"],"created_at":"2025-01-19T20:26:59.047Z","updated_at":"2025-04-06T17:13:06.957Z","avatar_url":"https://github.com/HeinrichApfelmus.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Hackage](https://img.shields.io/hackage/v/operational.svg)](https://hackage.haskell.org/package/operational)\n\n**Operational** is a tiny library for **implementing monads** by specifying the primitive instructions and their operational semantics. The monad laws will hold automatically. It can also be used to define monad transformers where the lifting laws hold automatically.\n\nUsing operational semantics simplifies the implementation of monads with tricky control flow, such as:\n\n* web applications in sequential style\n* games with a uniform interface for human and AI players, and automatic replay\n* fast parser monads\n* monadic DSLs of any kind\n* ...\n\nAny monad and monad transformer can be implemented in this fashion.\n\nThe library is based on the article [The Operational Monad Tutorial][tutorial], published in [Issue 15 of The Monad.Reader][reader].\n\n## Example\n\nFor example, imagine that you want to write a web application where the user is guided through a sequence of tasks (\"wizard\"). To structure your application, you can use a custom monad that supports an instruction `askUserInput :: CustomMonad UserInput`. This command sends a web form to the user and returns a result when he submits the form. However, you don't want your server to block while waiting for the user, so you have to suspend the computation and resume it at some later point. Sounds tricky to implement? This library makes it easy:\n\nThe idea is to identify a set of primitive instructions and to specify their operational semantics. Then, the library makes sure that the monad laws hold automatically. In the web application example, the primitive instruction would be `AskUserInput`.\n\nThe above example is implemented in [WebSessionState.lhs](doc/examples/WebSessionState.lhs).\n\n## Documentation\n\n[More documentation and examples are included in the `doc/` folder](doc/).\n\n\n## Related\n\nSources and inspiration for this library include\n\n* [Chuan-kai Lin's unimo paper][unimo]\n* J. Hughes, [The Design of a Pretty-printing Library][hughes], (1995)\n* [Ryan Ingram's `MonadPrompt` package][prompt].\n\nRelated packages included\n\n* [MonadPrompt](http://hackage.haskell.org/package/MonadPrompt)\n* [free](http://hackage.haskell.org/package/free)\n* [free-operational](http://hackage.haskell.org/package/free-operational)\n\n  [reader]: http://themonadreader.wordpress.com/2010/01/26/issue-15/\n  [tutorial]: http://apfelmus.nfshost.com/articles/operational-monad.html\n  [unimo]: http://web.cecs.pdx.edu/~cklin/papers/unimo-143.pdf \"Chuan-kai Lin. Programming Monads Operationally with Unimo.\"\n  [hughes]: http://citeseer.ist.psu.edu/hughes95design.html \"John Hughes. The Design of a Pretty-printing Library.\"\n  [prompt]: http://hackage.haskell.org/package/MonadPrompt \"Ryan Ingram's Monad Prompt Package.\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheinrichapfelmus%2Foperational","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheinrichapfelmus%2Foperational","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheinrichapfelmus%2Foperational/lists"}