{"id":23010815,"url":"https://github.com/kdungs/go-result","last_synced_at":"2025-07-28T12:36:53.042Z","repository":{"id":164092923,"uuid":"627638584","full_name":"kdungs/go-result","owner":"kdungs","description":"Result types for Go; because (T, error) can be considered a ✨ monad ✨.","archived":false,"fork":false,"pushed_at":"2023-05-11T17:52:25.000Z","size":80,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-08T07:25:55.685Z","etag":null,"topics":["experiments","functional-programming","go","golang","monad"],"latest_commit_sha":null,"homepage":"","language":"Go","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/kdungs.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}},"created_at":"2023-04-13T22:16:57.000Z","updated_at":"2023-04-19T16:32:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"b6dcf12d-710b-4533-aa76-68aac791a7e0","html_url":"https://github.com/kdungs/go-result","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdungs%2Fgo-result","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdungs%2Fgo-result/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdungs%2Fgo-result/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdungs%2Fgo-result/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kdungs","download_url":"https://codeload.github.com/kdungs/go-result/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246853716,"owners_count":20844634,"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":["experiments","functional-programming","go","golang","monad"],"created_at":"2024-12-15T09:42:33.101Z","updated_at":"2025-04-02T16:45:35.392Z","avatar_url":"https://github.com/kdungs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Result types for Go\n\n_Because `(T, error)` can be considered a ✨ monad ✨._\n\n\u003e Your scientists were so preoccupied with whether or not they could that they didn't stop to think if they should!\n\nImagine Go code without `if err != nil`. Would this be sacrilege? You might think so. For me, it was a fun exercise to get to know Go generics. Don't try this ~~at home~~ in prod.\n\nThe central idea is to treat `(T, error)` as a monad. There are two separate packages that implement this idea in different ways:\n\n1.  [`package result`](result/) exposes a dedicated type `R[T]` that wraps `(T, error)`. On top of that, it implements functions to perform computations on `R[T]`. Since Go does not have generic member functions, those are free functions.\n2.  [`package then`](then/) offers functionality to (lazily) compose functions that return `(T, error)`.\n\nThere's actually an [ongoing discussion around how to improve error handling in Go 2](https://go.googlesource.com/proposal/+/master/design/go2draft-error-handling.md).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdungs%2Fgo-result","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkdungs%2Fgo-result","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdungs%2Fgo-result/lists"}