{"id":18694967,"url":"https://github.com/rybla/monadic-equality","last_synced_at":"2025-06-28T00:05:57.914Z","repository":{"id":54301308,"uuid":"333789200","full_name":"rybla/monadic-equality","owner":"rybla","description":null,"archived":false,"fork":false,"pushed_at":"2021-04-23T20:08:51.000Z","size":1914,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-18T23:34:44.277Z","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/rybla.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}},"created_at":"2021-01-28T14:48:51.000Z","updated_at":"2021-03-09T17:58:57.000Z","dependencies_parsed_at":"2022-08-13T11:20:59.352Z","dependency_job_id":null,"html_url":"https://github.com/rybla/monadic-equality","commit_stats":null,"previous_names":["rybla/monadic-equality"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rybla/monadic-equality","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rybla%2Fmonadic-equality","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rybla%2Fmonadic-equality/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rybla%2Fmonadic-equality/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rybla%2Fmonadic-equality/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rybla","download_url":"https://codeload.github.com/rybla/monadic-equality/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rybla%2Fmonadic-equality/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262352621,"owners_count":23297689,"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-07T11:13:29.863Z","updated_at":"2025-06-28T00:05:57.892Z","avatar_url":"https://github.com/rybla.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# monadic-equality\n\nFormulating equality of\n[monadic](https://hackage.haskell.org/package/base-4.14.1.0/docs/Control-Monad.html)\nterms in [Liquid Haskell](http://ucsd-progsys.github.io/liquidhaskell/).\n\n## Why Monadic Equality?\n\nConsider the monad laws:\n\n```\n       q \u003e\u003e lift = m\n\n     lift x \u003e\u003e k = k x\n\n(q \u003e\u003e= k1) \u003e\u003e k2 = q \u003e\u003e= (k1 \u003e=\u003e k2)\n```\n\nwhere\n\n```\nm     :: * -\u003e * where Monad m\n\nx     :: a\nq     :: m a\nk, k1 :: a -\u003e m b\nk2    :: b -\u003e m c\nlift  ::\n(\u003e\u003e=) :: m a -\u003e (a -\u003e m b) -\u003e m b\n(\u003e=\u003e) :: (a -\u003e m b) -\u003e (b -\u003e m c) -\u003e (a -\u003e m c)\n```\n\nThese laws are equalities between monadic terms. But what kind of quality is it?\nWell, if we are using the `Writer String Int = (String, Int)` monadic terms,\nthen the equality is the equality that the pair type `forall a b. (a, b)`\nderives from the equality of `String` and the equality of `Int`.\n\nHowever, what if we are using the `Reader String Int = String -\u003e Int`?\nGenerally, the arrow type `forall a b. a -\u003e b` doesn't derive any equality. So\nimplicitly we must be using some kind of extensionality, since the monad laws\nare for _all_ monads, not just the ones with non-extensional equalities.\n\nIn Liquid Haskell, extensional equality is not included for two main reasons:\n\n1. The SMT-solver backend for Liquid Haskell does not use quantifiers, so cannot\n   represent extensional equality.\n2. Liquid Haskell's SMT equality is not type-indexed, and type-unindexed\n   extensional equality is unsound.\n\nSo, to formulate monadic equality (i.e. equality of monadic terms) in Liquid\nHaskell, we need a notion of type-indexed propositional equality in order to\ninclude extensionality, and additionally a notion of monadic equality that\nrelies on propositional equality and may be either extensional or\nnon-extensional depending on the monad.\n\nThis work may perhaps be extendible to derive a certain kind of equality for\ngeneric typeclasses (of which `Monad` is one example).\n\n## Propositional Equality\n\nTODO\n\n## Monadic Equality\n\nTODO\n\n## Examples\n\nTODO\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frybla%2Fmonadic-equality","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frybla%2Fmonadic-equality","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frybla%2Fmonadic-equality/lists"}