{"id":13687476,"url":"https://github.com/kowainik/typerep-map","last_synced_at":"2025-05-01T12:34:01.192Z","repository":{"id":27562107,"uuid":"114418728","full_name":"kowainik/typerep-map","owner":"kowainik","description":"⚡️Efficient implementation of Map with types as keys","archived":false,"fork":false,"pushed_at":"2024-01-18T06:59:21.000Z","size":192,"stargazers_count":100,"open_issues_count":16,"forks_count":18,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-11-07T02:42:36.129Z","etag":null,"topics":["arrays","binary-search","cache","dependent-map","dmap","hacktoberfest","haskell","typerep-map"],"latest_commit_sha":null,"homepage":"https://kowainik.github.io/projects/typerep-map","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kowainik.png","metadata":{"funding":{"ko_fi":"kowainik","github":["vrom911"]},"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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-12-15T23:16:22.000Z","updated_at":"2024-10-20T16:06:26.000Z","dependencies_parsed_at":"2024-01-14T16:11:54.425Z","dependency_job_id":"8d819cb6-09f4-4c4d-8af0-0ed58af0be3d","html_url":"https://github.com/kowainik/typerep-map","commit_stats":{"total_commits":91,"total_committers":13,"mean_commits":7.0,"dds":0.5384615384615384,"last_synced_commit":"5787946c3c89c9b608f4d5308d2a27cc9a27761f"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kowainik%2Ftyperep-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kowainik%2Ftyperep-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kowainik%2Ftyperep-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kowainik%2Ftyperep-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kowainik","download_url":"https://codeload.github.com/kowainik/typerep-map/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224257696,"owners_count":17281762,"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":["arrays","binary-search","cache","dependent-map","dmap","hacktoberfest","haskell","typerep-map"],"created_at":"2024-08-02T15:00:55.273Z","updated_at":"2024-11-12T10:31:20.344Z","avatar_url":"https://github.com/kowainik.png","language":"Haskell","readme":"# typerep-map\n\n![logo](https://user-images.githubusercontent.com/8126674/44323413-788dd700-a484-11e8-842e-f224cfaa4206.png)\n\n[![GitHub CI](https://github.com/kowainik/typerep-map/workflows/CI/badge.svg)](https://github.com/kowainik/typerep-map/actions)\n[![Hackage](https://img.shields.io/hackage/v/typerep-map.svg?logo=haskell)](https://hackage.haskell.org/package/typerep-map)\n[![MPL-2.0 license](https://img.shields.io/badge/license-MPL--2.0-blue.svg)](LICENSE)\n\n\n`typerep-map` introduces `TMap` and `TypeRepMap` — data structures like [`Map`](http://hackage.haskell.org/package/containers-0.6.0.1/docs/Data-Map-Lazy.html#t:Map), but where types serve as keys, and values have the types specified in the corresponding key spots.\n\nFor the more details on the implementation see the following blog post:\n\n* [typerep-map step by step](https://kowainik.github.io/posts/2018-07-11-typerep-map-step-by-step)\n\n## Usage example\n\n```haskell\nghci\u003e import Data.TMap\n\nghci\u003e tm = insert True $ one (42 :: Int)\n\nghci\u003e size tm\n2\n\nghci\u003e res = lookup tm\n\nghci\u003e res :: Maybe Int\nJust 42\n\nghci\u003e res :: Maybe Bool\nJust True\n\nghci\u003e res :: Maybe String\nNothing\n\nghci\u003e lookup (insert \"hello\" tm) :: Maybe String\nJust \"hello\"\n\nghci\u003e member @Int tm\nTrue\n\nghci\u003e tm' = delete @Int tm\n\nghci\u003e member @Int tm'\nFalse\n```\n\n## Benchmarks\n\nTables below contain comparision with `DMap TypeRep` of ten `lookup` operations\non structure with size `10^4`:\n\n|                | ghc-8.2.2 | ghc-8.4.3 | ghc-8.8.3 | ghc-8.10.1 |\n|----------------|-----------|-----------|-----------|------------|\n| `DMap TypeRep` | 517.5 ns  | 779.9 ns  | 1.559 μs  | 1.786 μs   |\n| `typerep-map`  | 205.3 ns  | 187.2 ns  | 190.1 ns  | 169.1 ns   |\n\n ghc-8.2.2 |  ghc-8.4.3\n:---------:|:-----------:\n![DMap 8.2.2](https://user-images.githubusercontent.com/4276606/42495129-c700f21e-8454-11e8-98b4-ba080259c712.png) | ![DMap 8.4.3](https://user-images.githubusercontent.com/4276606/42495168-ebb1d13c-8454-11e8-9d17-f6da29d2169a.png)\n![TMap 8.2.2](https://user-images.githubusercontent.com/4276606/42494935-3a352d96-8454-11e8-985e-ebc77cc51ca0.png) | ![TMap 8.4.3](https://user-images.githubusercontent.com/4276606/42495147-d884bdf4-8454-11e8-887f-9815fd2b8d68.png)\n","funding_links":["https://ko-fi.com/kowainik","https://github.com/sponsors/vrom911"],"categories":["Haskell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkowainik%2Ftyperep-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkowainik%2Ftyperep-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkowainik%2Ftyperep-map/lists"}