{"id":19207622,"url":"https://github.com/danilafe/maypop","last_synced_at":"2025-10-09T14:14:17.077Z","repository":{"id":80322100,"uuid":"354186652","full_name":"DanilaFe/maypop","owner":"DanilaFe","description":"Dependently typed programming language implemented in Literate Haskell.","archived":false,"fork":false,"pushed_at":"2021-08-08T23:29:35.000Z","size":793,"stargazers_count":7,"open_issues_count":14,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T14:45:37.128Z","etag":null,"topics":["dependent-types","haskell","inference","language","monad","monad-transformers","programming-language"],"latest_commit_sha":null,"homepage":"https://web.engr.oregonstate.edu/~fedorind/CS583/","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/DanilaFe.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":"2021-04-03T03:06:08.000Z","updated_at":"2025-02-11T20:39:09.000Z","dependencies_parsed_at":"2023-07-31T20:00:18.128Z","dependency_job_id":null,"html_url":"https://github.com/DanilaFe/maypop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DanilaFe/maypop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanilaFe%2Fmaypop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanilaFe%2Fmaypop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanilaFe%2Fmaypop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanilaFe%2Fmaypop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DanilaFe","download_url":"https://codeload.github.com/DanilaFe/maypop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanilaFe%2Fmaypop/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001527,"owners_count":26083117,"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-10-09T02:00:07.460Z","response_time":59,"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":["dependent-types","haskell","inference","language","monad","monad-transformers","programming-language"],"created_at":"2024-11-09T13:21:03.207Z","updated_at":"2025-10-09T14:14:17.049Z","avatar_url":"https://github.com/DanilaFe.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# maypop\n\nThis is the repository for the Maypop language. Maypop aims\nto be a dependently typed language for verified functional programming.\n__In addition, it's written using Literate Haskell, and its source code\nthus contains a quasi-tutorial on how Maypop works. [Check it out!](https://web.engr.oregonstate.edu/~fedorind/CS583/).__\n\nThe goal isn't necessarily to make something to replace Coq or Agda, but\nto make a language of that sort whose codebase is small enough to understand!\n\nThe [`unification-fix`](https://github.com/DanilaFe/maypop/tree/unification-fix) branch contains work-in-progress\ntype inference and unification code. The quality of the code is currently\nnot up to `main` branch standards, but a lot of things work! Check out\nthe `stdlib/Prelude.mp` file on that branch for an example of a call\nto a typeclass-requiring function, and `stdlib/Class/Eq.mp` for a definition\nof that typeclass.\n\nUnless something in the pipeline is going wrong, the above link should\nbe up-to-date with the current commit on this repository.\n\n## What Works So Far\nCurrently, the Haskell code included can:\n\n* Represent Maypop terms, including inductive data types (GADTs).\n* Evaluate these terms.\n* Pretty print the terms.\n* Check the types of various terms (without type inference).\n* Perform unification (required for type inference).\n* Parse a (currently ugly) syntax for the language\n* Organize code into modules and import required definitions\n* Typecheck modules.\n\nUsing Maypop, we were able to define the addition of natural\nnumbers, and __prove the following properties about it__:\n\n* `0 + n = n`. This follows immediately from the definition of addition,\nand is not particularly interesting.\n* `n + 0 = n`. This does _not_ immediately follow from the \ndefinition of addition, and needs to be proved by induction.\n* `(1 + n) + m = n + (1 + m)`, which is a lemma used for the proof of...\n* `n + m = m + n`, also known as commutativity of addition!\n\nOn the [`unification-fix`](https://github.com/DanilaFe/maypop/tree/unification-fix) branch, the following\nthings work in addition to the above:\n\n* Type inference (save users the effort of writing types)\n* Type classes (__and automatic search for them__)\n\nWhat still needs to be done:\n\n* Tactics to make writing proofs easier\n\n## Design Decisions\n\n* Represent unification as a monad transformer (`MonadUnify` and `UnifyT`).\nInstead of writing a special purpose function for unifying terms, we have\nput this functionality into a general monad transformer (one that requires\n`MonadlAlternative` on the underlying monad). This was made to improve\nthe reusability of the code; while type inference relies on unification,\nso does logic programming, and our type class instance search seems to be\n(at least in simple cases) reducible to a Prolog-like database search.\nWe can mix in `LogicT` (from a paper by Oleg Kieselov) for backtracking,\nand implement a prolog-like language in 50 extra lines!\n* Use MTL style as much as possible. This helps us avoid a _lot_ of extra\ncode; we hide away a lot of the \"plumbing\" like environments and common\nvariables via `MonadReader`, handle errors via `MonadError`, and so on.\nBy using the MTL style of introducing constraints onto a monadic type\nvariable, we're able to make our code work in more contexts\n(for instance, we were able to swap out unification mechanisms in\nthe type inference code with virtually no changes to the inference\ncode itself), and to add various effects (such as unification)\nwith very little effort. By abstracting the common set of type\nclasses into a \"synonym\" class (like `MonadInfer`), we're able\nto further clean up our type signatures and simplify refactoring.\n* `IO` hardly occurs in our code; we even define special monad instances\nlike `MonadPath` for computations that can be used to interact with the\nfilesystem. We thus separate ourselves as much as possible from the concerns\nof impurity, and can focus on the purely functional \"core\" of our\napplication. Furthermore, this would allow us to perform additional\ntesting on our code by mocking the results of I/O actions: we can,\nfor instance, write a custom instance of `MonadModule`, which\nwould return predefined modules instead of trying to read from disk.\n\n## Running\nThe project is built using Stack. Thus, to enter GHCi with\nall of the relevant code, simply run:\n\n```\nstack ghci\n```\n\nTo run our (currently minimal) test suite, run:\n\n```\nstack test\n```\n\nThe test suite is currently the best place to look for example\ninputs. Check out the [`Spec`](https://web.engr.oregonstate.edu/~fedorind/CS583/modules/spec/)\npage, which includes not only the Haskell representation of various example\nterms, but also explanations on why these terms have particular types.\nIt even has neatly rendered mathematical notation! If the page is down,\nthe `Spec.lhs` file in `src/` will include the same information (albeit in\na less pretty format).\n\nOther that that, we also have a barebones application that loads a Maypop\nfile and typechecks it. For instance, you can run:\n\n```\nstack run stdlib/Data/Pair.mp\n```\n\nThis will load the file `stdlib/Data/Pair.mp`, and print all the function\nthat are defined with it. If the module contains errors, the error will\nbe printed instead. You can define your own modules anywhere; however,\nif you import anything in that module file, the interpreter will\nonly search the `stdlib` folder. For example, importing `Data.Bool`\nwill search `stdlib/Data/Bool.mp`.\n\n## File Structure\nThere are a lot of files here, but there's some order to this chaos.\nHere are the interesting directories:\n\n* `src/` contains the source code for the language itself. If you're from CS 583, that's mostly\nwhere you'll want to look. There, and in the `test/` folder.\n* `test/` contains tests (property based and unit) for the language. It is written\nin Literate Haskell much like the rest of the project, so hopefully the examples\nare somewhat clear.\n* `app/` is the location for the Maypop interpreter. Right now, only a barebones\nfile loader is there. Stay tuned!\n* `doc/` contains the various documents we've had to produce for the class.\n* `misc/` includes Haskell files that are not strictly relevant to the language,\nsuch as experiments.\n* `script/` has the scripts we use to turn the Literate Haskell source code\nof Maypop into Hugo-compatible Markdown.\n* `content/` is the directory for Hugo content files, written in Markdown.\nA handful of these files will be handcrafted (such as the landing page);\nthe rest, however, will be placed there by the scripts mentioned above.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanilafe%2Fmaypop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanilafe%2Fmaypop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanilafe%2Fmaypop/lists"}