{"id":32174415,"url":"https://github.com/sphaso/noether","last_synced_at":"2026-02-19T08:03:10.606Z","repository":{"id":34970790,"uuid":"189455360","full_name":"sphaso/noether","owner":"sphaso","description":"Algebra utilities for Elixir","archived":false,"fork":false,"pushed_at":"2024-10-24T16:44:19.000Z","size":51,"stargazers_count":23,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-01T08:15:10.882Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sphaso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-05-30T17:29:21.000Z","updated_at":"2025-01-31T23:07:43.000Z","dependencies_parsed_at":"2024-10-24T21:02:39.120Z","dependency_job_id":"d784dbbb-2f8a-4577-9141-903248ee2482","html_url":"https://github.com/sphaso/noether","commit_stats":{"total_commits":36,"total_committers":13,"mean_commits":2.769230769230769,"dds":0.6111111111111112,"last_synced_commit":"557024135f855735b215f3aa4872a89d01510673"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/sphaso/noether","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sphaso%2Fnoether","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sphaso%2Fnoether/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sphaso%2Fnoether/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sphaso%2Fnoether/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sphaso","download_url":"https://codeload.github.com/sphaso/noether/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sphaso%2Fnoether/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29608152,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":[],"created_at":"2025-10-21T19:01:30.831Z","updated_at":"2026-02-19T08:03:10.601Z","avatar_url":"https://github.com/sphaso.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Noether\n\n[![Build Status](https://github.com/sphaso/noether/actions/workflows/elixir.yml/badge.svg?branch=main)](https://github.com/sphaso/noether/actions/workflows/elixir.yml)\n\nNoether aims to ease common data manipulation tasks by introducing simple algebraic functions and other utilities.\nFunctions and names are inspired (sometimes taken as-is) from Haskell.\n\nThe `Maybe` module introduces operations on nullable values.\nThe `Either` module introduces operations on `{:ok, _} | {:error, _}` values.\nThe `List` module introduces operations on lists.\n\nThe root module has a few simple functions one might find of use.\n\n## Installation\n\n```elixir\ndef deps do\n  [\n    {:noether, \"~\u003e 1.0.0\"}\n  ]\nend\n```\n\n## Examples\n\nHere is a list of real world scenarios where you may find that using constructs like `Maybe` and `Either` make your code less verbose, more straightforward, and easier to read.\n\nSuppose you have a function that returns a list of items, and you want to take the first element (if the list is not empty), apply a function to it, and wrap it in a nice `{:ok, _}` or `{:error, _}` tuple.\n\nWithout Noether, you would write something like this:\n\n```elixir\nfunction_that_returns_list_of_items()\n|\u003e List.first()\n|\u003e update_item(\u0026f/1)\n|\u003e case do\n  nil -\u003e\n    {:error, :not_found}\n\n  item -\u003e\n    {:ok, item}\nend\n\ndefp update_item(nil), do: nil\ndefp update_item(item, f), do: f.(item)\n```\n\nThat's kind of verbose, especially since you need to type the functions that pattern match on `nil` and those that wrap a result in a tuple. Moreover, what if `function_that_returns_list_of_items` does not return just a list, but it may return an error as well? That's another `case do`!\n\nLet's see how we could accomplish the same with Noether:\n\n```elixir\nalias Noether.Maybe\n\nfunction_that_returns_list_of_items()\n|\u003e List.first()\n|\u003e Maybe.map(\u0026f/1)\n|\u003e Maybe.required(:not_found)\n```\n\n`Maybe` operates on nullable values, while `Either` operates on `{:ok, _}` or `{:error, _}` tuples. Let's see how we can reduce the verbosity of elixir `with` operator using `Either.bind/2`.\n\nSuppose you have N chained calls to different functions, where each one may return a tuple, and finally you want to return the \"unwrapped\" result to the caller. Normally, you would accomplish it this way:\n\n```elixir\nwith {:ok, _res1} \u003c- f1(),\n  {:ok, _res2} \u003c- f2(),\n  {:ok, _res3} \u003c- f3(),\n  {:ok, res4} \u003c- f4() do\n  res4\nend\n```\n\nIt can easily get frustrating and error-prone to write everytime the same `{:ok, _}` matches. Let's see how we can do this using Noether:\n\n```elixir\nalias Noether.Either\nalias Noether.List\n\n[f1(), f2(), f3(), f4()]\n|\u003e List.sequence()\n|\u003e Either.unwrap()\n```\n\nEasier to read, less verbose, and it encapsulates the handling of `{:ok, _}` tuples. You can focus on writing actual logic instead of repeating the same pattern matches every time.\n\n## Contributing\n\nFeel free to propose any function you deem useful and even vaguely related to the ones currently present.    \nRegarding naming, we have a couple of conventions:    \n- function names should be taken from Haskell if they exist, aliases with Scala naming are possible (e.g. `bind` is aliased into `flat_map`)    \n- function arguments are named `a, b, c ...` if values (exception: `default`), `f, g, h ...` if functions    \n\n`mix test` runs the tests.    \n`mix format.all` formats all the files under `lib/`.    \n`mix check` checks if the files are formatted; it then runs a linter (`credo`) and a type checker (`dyalixir`).    \n\n## Special thanks to our contributors!\n- [Giovanni Panice](https://github.com/kmos)\n- [Pablo Costas](https://github.com/pablocostass)\n- [Paolo Simone](https://github.com/paolosimone)\n- [Fabio Vitale](https://github.com/c0m3tx)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsphaso%2Fnoether","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsphaso%2Fnoether","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsphaso%2Fnoether/lists"}