{"id":21634076,"url":"https://github.com/bedrocksystems/coq-lens","last_synced_at":"2025-04-11T15:30:28.122Z","repository":{"id":45062419,"uuid":"138612288","full_name":"bedrocksystems/coq-lens","owner":"bedrocksystems","description":"Lenses in Coq","archived":false,"fork":false,"pushed_at":"2022-10-07T12:54:00.000Z","size":48,"stargazers_count":17,"open_issues_count":8,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T11:39:08.987Z","etag":null,"topics":["coq","lenses"],"latest_commit_sha":null,"homepage":null,"language":"Coq","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/bedrocksystems.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":"2018-06-25T15:15:31.000Z","updated_at":"2025-03-06T03:18:03.000Z","dependencies_parsed_at":"2023-01-19T14:01:20.271Z","dependency_job_id":null,"html_url":"https://github.com/bedrocksystems/coq-lens","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bedrocksystems%2Fcoq-lens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bedrocksystems%2Fcoq-lens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bedrocksystems%2Fcoq-lens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bedrocksystems%2Fcoq-lens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bedrocksystems","download_url":"https://codeload.github.com/bedrocksystems/coq-lens/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248431189,"owners_count":21102152,"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":["coq","lenses"],"created_at":"2024-11-25T03:15:39.799Z","updated_at":"2025-04-11T15:30:28.094Z","avatar_url":"https://github.com/bedrocksystems.png","language":"Coq","funding_links":[],"categories":[],"sub_categories":[],"readme":"# coq-lens\nAn implementation of lenses in Coq. This package uses [meta-coq](https://github.com/MetaCoq/metacoq) to generate lenses for records.\n\n## Use\nSee `demo.v` in the `test-suite` directory. A simple example is included below.\n\n```coq\nSet Primitive Projections.\n\nRecord Foo : Set :=\n{ foo : nat\n; bar : bool\n}.\nRun TemplateProgram (genLens Foo). (* generates _foo and _bar *)\n\nAbout _foo. (* : Lens Foo Foo nat nat *)\nAbout _bar. (* : Lens Foo Foo bool bool *)\n\nGoal view _foo {| foo := 3 ; bar := true |} = 3.\nProof. reflexivity. Qed.\n\nGoal view _bar {| foo := 3 ; bar := true |} = true.\nProof. reflexivity. Qed.\n\nGoal set _bar false {| foo := 3 ; bar := true |} = {| foo := 3 ; bar := false |}.\nProof. reflexivity. Qed.\n```\n\n## Limitations\nGeneration of lenses via template-coq is currently only supports `Record`s defined with `Primitive Projections` enabled. Further, it does not support:\n\n- Polymorphic lenses\n- Universe polymorphic definitions\n- Universe polymorphic lenses\n\n### Implementation Note\nUnlike the Haskell implementation, this implementation is significantly more first-order, prefering separate `get` and `set` functions packaged as a record. This has several benefits in Coq.\n\n1. We don't need to depend on a `Functor` class.\n2. We don't require extra universes for the types of the universally quantified functor.\n3. Error messages are simpler and type checking does not rely on typeclass inference which is not as robust as it is in Haskell due to the dependent nature of Gallina.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbedrocksystems%2Fcoq-lens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbedrocksystems%2Fcoq-lens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbedrocksystems%2Fcoq-lens/lists"}