{"id":13702125,"url":"https://github.com/danidiaz/really-small-backpack-example","last_synced_at":"2026-01-18T12:44:29.640Z","repository":{"id":38486252,"uuid":"128645457","full_name":"danidiaz/really-small-backpack-example","owner":"danidiaz","description":"A really small example of the Backpack module system for Haskell","archived":false,"fork":false,"pushed_at":"2024-12-29T10:40:37.000Z","size":149,"stargazers_count":54,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-05T04:36:09.912Z","etag":null,"topics":["backpack","haskell","tutorial"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danidiaz.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-04-08T13:43:28.000Z","updated_at":"2025-02-10T08:33:26.000Z","dependencies_parsed_at":"2025-05-05T04:30:52.793Z","dependency_job_id":"4e717946-664c-4ca4-a339-fab9a03006f0","html_url":"https://github.com/danidiaz/really-small-backpack-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/danidiaz/really-small-backpack-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danidiaz%2Freally-small-backpack-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danidiaz%2Freally-small-backpack-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danidiaz%2Freally-small-backpack-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danidiaz%2Freally-small-backpack-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danidiaz","download_url":"https://codeload.github.com/danidiaz/really-small-backpack-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danidiaz%2Freally-small-backpack-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28536011,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T10:13:46.436Z","status":"ssl_error","status_checked_at":"2026-01-18T10:13:11.045Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["backpack","haskell","tutorial"],"created_at":"2024-08-02T21:00:31.501Z","updated_at":"2026-01-18T12:44:29.618Z","avatar_url":"https://github.com/danidiaz.png","language":"Haskell","funding_links":[],"categories":["Backpack"],"sub_categories":["Tutorials"],"readme":"# really-small-backpack-example\n\nThis is a small tutorial on the very basics of the Backpack module system.\n(Well... at least it started that way. It has grown a bit over time.)\n\nIt requires [`cabal-install \u003e= 3.2.0.0`](https://www.haskell.org/cabal/) and `GHC \u003e= 9.0.1`. You can install both using [ghcup](https://www.haskell.org/ghcup/).\n\nIt is a [multi-package\nproject](https://cabal.readthedocs.io/en/3.4/nix-local-build.html#developing-multiple-packages).\nYou can build all the packages from this folder using:\n\n```\ncabal build all\n```\n\nAny corrections welcome!\n\n# lessons\n\n- [00 - convenience libraries](./lesson0-convenience-libraries)\n- [01 - renaming modules](./lesson1-renaming-modules)\n- [02 - signatures](./lesson2-signatures)\n- [03 - signature merging](./lesson3-signature-merging)\n- [04 - signature thinning](./lesson4-signature-thinning)\n- [05 - abstract typeclasses](./lesson5-abstract-typeclasses)\n- [06 - abstracting monad stacks](./lesson6-abstracting-monad-stacks)\n- [07 - module identity](./lesson7-module-identity)\n- [08 - transitively indefinite packages](./lesson8-transitively-indefinite-packages)\n- [09 - template haskell](./lesson9-template-haskell)\n- [10 - coercing proofs](./lesson10-coercing-proofs)\n- [11 - controlling encapsulation](./lesson11-controlling-encapsulation)\n- [12 - abstracting type families](./lesson12-abstracting-type-families)\n\n# Further resources for learning Backpack\n\n## User guides\n\n- A detailed description in the GHC User Guide of [what can be put into a module\nsignature](https://downloads.haskell.org/ghc/latest/docs/html/users_guide/separate_compilation.html#module-signatures).\nThis is Backpack seen from the language side.\n\n- [The Backpack section of the Cabal User\n  Guide](https://cabal.readthedocs.io/en/latest/cabal-package.html#backpack)\n  and also the sections about [module\n  signatures](https://cabal.readthedocs.io/en/latest/cabal-package.html#pkg-field-library-signatures)\n  and\n  [mixins](https://cabal.readthedocs.io/en/latest/cabal-package.html#pkg-field-mixins).\n  This is Backpack seen from the package manager side.\n\n## The theory behind Backpack\n\n- Edward Z. Yang's [thesis](https://github.com/ezyang/thesis/releases) is quite\nreadable and gives a good account of the motivations for Backpack.\n\n- Edward Z. Yang's [blog](http://blog.ezyang.com/category/haskell/backpack/).\n\n- Scott Kilpatrick's\n[thesis](https://www.reddit.com/r/haskell/comments/e7gopg/new_haskell_phd_thesis_on_backback_foundations/).\nNot as directly applicable to the current implementation of Backpack as Edward\nZ. Yang's thesis, but useful insights can be gleaned here.\n\n## The implementation\n\n- [Backpack design ticket #3038](https://github.com/haskell/cabal/issues/3038).\n\n- [relationship between ComponentId, UnitId, MungedPackageId, PackageId etc.](https://github.com/haskell/cabal/issues/5809).\n\n- [about units](https://github.com/ghc/ghc/blob/ce1b8f4208530fe6449506ba22e3a05048f81564/compiler/GHC/Unit.hs#L25).\n\n- [GHC Issue #20890: Multiple home units and Backpack together](https://gitlab.haskell.org/ghc/ghc/-/issues/20890).\n\n## Other Backpack-related stuff\n\n- The [Backpack](https://wiki.haskell.org/Backpack) and [Module\nSignature](https://wiki.haskell.org/Module_signature) entries in the\nHaskellwiki.\n\n- [GHC proposal](https://github.com/ezyang/ghc-proposals/blob/backpack/proposals/0000-backpack.rst). Interesting bits about the motivation and limits of Backpack.\n\n- I wrote a few Backpack tips \u0026 tricks\n[here](httpstter.com/geoffreylitt/status/1379579340925632512://medium.com/@danidiaz/backpacking-tips-3adb727bb8f7) and\n[here](https://medium.com/@danidiaz/backpacking-tips-ii-47fa86e5bf2).\n\n- [Example of an abstract package on Hackage which uses\nsignatures](http://hackage.haskell.org/package/unpacked-containers). Discussed\n[here](https://www.reddit.com/r/haskell/comments/8a5w1n/new_package_unpackedcontainers/).\n\n- [A signature for streaming libraries](https://github.com/danidiaz/streamy)\n\n- [picnic: put containers into a\n  backpack](https://kowainik.github.io/posts/2018-08-19-picnic-put-containers-into-a-backpack)\n  [reddit](https://www.reddit.com/r/haskell/comments/98jegn/blog_post_picnic_put_containers_into_a_backpack/)\n  Features an interesting example of abstracting over classes. (See also lesson\n  5 of this tutorial.)\n\n- [a blog post about common stanzas in .cabal\n  files](https://vrom911.github.io/blog/common-stanzas). Not directly related\n  to Backpack, but both `build-depends` and `mixins` fields can be put into\n  common stanzas, which can then be imported by multiple libraries/executables\n  in the package. This can help avoid duplication in the .cabal file. [An\n  example](https://stackoverflow.com/a/59740286/1364288).\n\n- [using Backpack to get around problems with overlapping\n  instances](https://www.reddit.com/r/haskell/comments/f3b0ie/ann_acts_semigroup_actions_groups_and_torsors/fhk4wpw/)\n\n- [Monad Transformers and Effects with Backpack](https://blog.ocharles.org.uk/posts/2020-12-23-monad-transformers-and-effects-with-backpack.html). [reddit](https://www.reddit.com/r/haskell/comments/kjer0o/monad_transformers_and_effects_with_backpack/).\n\n- [version 0.3.0 of cryptographic library \"raaz\" uses Bapckpack internally](http://hackage.haskell.org/package/raaz-0.3.0). [ergonomic issues](https://www.reddit.com/r/haskell/comments/nkvdwp/ergonomic_issues_with_using_backpack/).\n\n- [moo-nad](http://hackage.haskell.org/package/moo-nad) A tiny library that combines module signatures and the \"`ReaderT` pattern\".\n\n- [a few extant bugs, and a possible way forward](https://discourse.haskell.org/t/hf-tech-proposal-1-utf-8-encoded-text/2499/22)\n\n\n## Stuff about module systems in general\n\n- [Understanding and Evolving the ML Module System](https://people.mpi-sws.org/~dreyer/thesis/main.pdf) by Derek Dreyer.\n\n- [Modular Type Classes\n  (2007)](http://people.mpi-sws.org/~dreyer/papers/mtc/main-long.pdf)\n  reconstruction of Haskell typeclasses in terms of ML modules \"classes are\n  signatures, instances are modules\" \n\n- [ML Modules and Haskell Type Classes: A Constructive Comparison\" (2008)](http://priv.stefanwehr.de/publications/Wehr_ML_modules_and_Haskell_type_classes_SHORT.pdf])\n\n- [Logical relations as\n  types](https://twitter.com/jonmsterling/status/1386647300244639747) by\n  Sterling and Harper. [video](https://www.youtube.com/watch?v=AEthjg2k718).\n  This went way over my head, but it seems to propose a method to verify that a\n  module implementation has the same external behaviour as some (presumably\n  simpler) reference implementation.\n\n- [Modules as dependent records tweet](https://twitter.com/jonmsterling/status/1390346042823086084). \n\n- [Do-it-Yourself Module Systems](https://twitter.com/Iceland_jack/status/1390863512684093448) PhD thesis.\n\n- [Abstract Data Types without the Types](https://homepages.inf.ed.ac.uk/wadler/papers/turner-festschrift/turner-festschrift.pdf).\n\n- [Repo with a bibliography about ML module systems](https://github.com/elpinal/modules). [web page](https://elpinal.gitlab.io/modules-bib/). [Mastodon post](https://mathstodon.xyz/@elpinal/109676784280690403).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanidiaz%2Freally-small-backpack-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanidiaz%2Freally-small-backpack-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanidiaz%2Freally-small-backpack-example/lists"}