{"id":25232936,"url":"https://github.com/tweag/linear-base","last_synced_at":"2026-05-13T09:01:24.976Z","repository":{"id":37773906,"uuid":"111791393","full_name":"tweag/linear-base","owner":"tweag","description":"Standard library for linear types in Haskell.","archived":false,"fork":false,"pushed_at":"2026-05-11T06:17:09.000Z","size":2206,"stargazers_count":356,"open_issues_count":56,"forks_count":45,"subscribers_count":31,"default_branch":"master","last_synced_at":"2026-05-11T08:27:04.209Z","etag":null,"topics":["haskell","linear-types"],"latest_commit_sha":null,"homepage":"","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/tweag.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-11-23T09:46:09.000Z","updated_at":"2026-05-11T06:17:13.000Z","dependencies_parsed_at":"2023-11-07T02:45:20.471Z","dependency_job_id":"99a6ace6-ccb6-4bae-9615-9d5ca6e5f2b6","html_url":"https://github.com/tweag/linear-base","commit_stats":{"total_commits":636,"total_committers":30,"mean_commits":21.2,"dds":0.7641509433962264,"last_synced_commit":"63f61664f6604f4bdb48922de814de4f23172ee5"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/tweag/linear-base","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tweag%2Flinear-base","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tweag%2Flinear-base/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tweag%2Flinear-base/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tweag%2Flinear-base/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tweag","download_url":"https://codeload.github.com/tweag/linear-base/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tweag%2Flinear-base/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32975183,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T06:31:55.726Z","status":"ssl_error","status_checked_at":"2026-05-13T06:31:51.336Z","response_time":115,"last_error":"SSL_read: 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":["haskell","linear-types"],"created_at":"2025-02-11T13:37:18.847Z","updated_at":"2026-05-13T09:01:24.958Z","avatar_url":"https://github.com/tweag.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linear base\n\n[![License MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/tweag/linear-base/blob/master/LICENSE)\n[![Hackage](https://img.shields.io/hackage/v/linear-base.svg?style=flat\u0026color=brightgreen)][hackage-pkg]\n[![Stackage](https://stackage.org/package/linear-base/badge/nightly)][stackage-pkg]\n[![Discord](https://img.shields.io/badge/Discord-100000?style=flat\u0026logo=Discord\u0026logoColor=C3C3C3\u0026labelColor=4179DA\u0026color=010101)][discord]\n\nLinear base is a standard library for developing applications with linear\ntypes. It is named `linear-base` to be an analog to the original [`base`]\npackage that ships with GHC.\n\nThe purpose of `linear-base` is to provide the minimal facilities you need to\nwrite _practical_ Linear Haskell code, i.e., Haskell code that uses the\n`-XLinearTypes` language extension.\n\n## Motivation\n\n_Why do you need `linear-base` to write linear projects?_\n\n1. Data types, functions and classes in `base` are not linear types\n  aware. For instance, if `n` is a linearly-bound `Int`, the RHS of\n  a definition cannot write `n + 1` — this will not type check. We\n  need linear variants of `Num`, `Functor`s, `Monad`s, `($)`, etc.\n\n2. This library exports new abstractions that leverage linear types\n  for resource safety or performance. For example, there are new APIs\n  for file and socket I/O as well as for safe in-place mutation of\n  arrays.\n\n## Getting started\n\n`-XLinearTypes` is released with GHC 9, and `linear-base` is released\non [Hackage][hackage-pkg] and [Stackage][stackage-pkg].\n\nAll source files with linear types need a language extension pragma at\nthe top:\n\n```\n{-# LANGUAGE LinearTypes #-}\n```\n\nTo get in touch, you can join our\n[![Discord](https://img.shields.io/badge/Discord-100000?style=flat\u0026logo=Discord\u0026logoColor=C3C3C3\u0026labelColor=4179DA\u0026color=010101)][discord] server\n\n\n## User Guide\n\nIf you already know what `-XLinearTypes` does and what the linear\narrow `a %1-\u003e b` means, then read the [User Guide] and explore the\n[`examples/`](https://github.com/tweag/linear-base/blob/master/examples) folder to know how to use `linear-base`.\n\nYou can also find a table comparing `base` and `linear-base` typeclasses\n[here](https://github.com/tweag/linear-base/blob/master/docs/CLASS_TABLE.md).\n\n## Learning about `-XLinearTypes`\n\nIf you're a Haskeller who hasn't written any Linear Haskell code, don't fear!\nThere are plenty of excellent resources and examples to help you.\n\n### Tutorials and examples\n\n * See the [`examples/`](https://github.com/tweag/linear-base/blob/master/examples) folder.\n * [Linear examples on watertight 3D models](https://github.com/gelisam/linear-examples)\n\n### Reading material\n\n  * There is a [wiki page](https://gitlab.haskell.org/ghc/ghc/-/wikis/linear-types).\n  * Key Blog posts\n    * [Predictable performance](https://www.tweag.io/posts/2017-03-13-linear-types.html) (the first blog post from Tweag on this)\n    * [IO State Transitions](https://www.tweag.io/posts/2017-08-03-linear-typestates.html)\n    * [Streaming](https://www.tweag.io/posts/2018-06-21-linear-streams.html)\n    * See [here](https://www.tweag.io/blog/tags/linear-types/) for all of Tweag's blog posts on linear types.\n  * [Here is the paper](https://arxiv.org/pdf/1710.09756.pdf) behind `-XLinearTypes`.\n\n### Talks\n–\n * [Distributed Programming with Linear Types – Haskell Exchange 2017](https://skillsmatter.com/skillscasts/10637-distributed-programming-with-linear-types)\n * [Practical Linearity in a higher-order polymorphic language – POPL 2018](https://www.youtube.com/watch?v=o0z-qlb5xbI)\n * [Practical Linearity in a higher-order polymorphic language – Curry on 2018](https://www.youtube.com/watch?v=t0mhvd3-60Y)\n * [Practical Linearity in a higher-order polymorphic language – Haskell Exchange 2018](https://skillsmatter.com/skillscasts/11067-keynote-linear-haskell-practical-linearity-in-a-higher-order-polymorphic-language)\n * [Implementing Linear Haskell](https://www.youtube.com/watch?v=uxv62QQajx8)\n * [In-place array update with linear types – ZuriHac 2020](https://www.youtube.com/watch?v=I7-JuVNvz78)\n * [Typecheck Your Memory Management with Linear Types – Haskell Exchange 2017](https://skillsmatter.com/skillscasts/14896-typecheck-your-memory-management-with-linear-types)\n\n## Contributing\n\nLinear base is maintained by [Tweag].\n\nTo contribute please see the [Design Document] for instructions and advice on\nmaking pull requests.\n\nA great first step is to join our\n[![Discord](https://img.shields.io/badge/Discord-100000?style=flat\u0026logo=Discord\u0026logoColor=C3C3C3\u0026labelColor=4179DA\u0026color=010101)][discord] server\n\n## Licence\n\nSee the [Licence file](https://github.com/tweag/linear-base/blob/master/LICENSE).\n\nCopyright © Tweag Holding and its affiliates.\n\n[Tweag]: https://www.tweag.io/\n[`base`]: https://hackage.haskell.org/package/base\n[User Guide]: https://github.com/tweag/linear-base/blob/master/docs/USER_GUIDE.md\n[Design Document]: https://github.com/tweag/linear-base/blob/master/docs/DESIGN.md\n[hackage-pkg]: https://hackage.haskell.org/package/linear-base\n[stackage-pkg]: https://www.stackage.org/nightly/package/linear-base\n[discord]: https://discord.com/invite/7yg5GxzvDJ\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftweag%2Flinear-base","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftweag%2Flinear-base","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftweag%2Flinear-base/lists"}