{"id":41373839,"url":"https://github.com/mono83/maybe","last_synced_at":"2026-01-23T09:55:30.654Z","repository":{"id":59044174,"uuid":"528035203","full_name":"mono83/maybe","owner":"mono83","description":"Generic Maybe monad implementation in Go","archived":false,"fork":false,"pushed_at":"2022-09-22T18:36:28.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-20T09:03:06.883Z","etag":null,"topics":["generics","golang","maybe","monads"],"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/mono83.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}},"created_at":"2022-08-23T14:45:20.000Z","updated_at":"2022-08-24T08:12:17.000Z","dependencies_parsed_at":"2023-01-18T17:25:28.286Z","dependency_job_id":null,"html_url":"https://github.com/mono83/maybe","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mono83/maybe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mono83%2Fmaybe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mono83%2Fmaybe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mono83%2Fmaybe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mono83%2Fmaybe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mono83","download_url":"https://codeload.github.com/mono83/maybe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mono83%2Fmaybe/sbom","scorecard":{"id":658724,"data":{"date":"2025-08-11","repo":{"name":"github.com/mono83/maybe","commit":"4490c02eeac8345d9e99415cab3c511a6985c4d6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/12 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T15:27:15.872Z","repository_id":59044174,"created_at":"2025-08-21T15:27:15.872Z","updated_at":"2025-08-21T15:27:15.872Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28687324,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T05:48:07.525Z","status":"ssl_error","status_checked_at":"2026-01-23T05:48:07.129Z","response_time":59,"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":["generics","golang","maybe","monads"],"created_at":"2026-01-23T09:55:30.089Z","updated_at":"2026-01-23T09:55:30.647Z","avatar_url":"https://github.com/mono83.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Maybe\n=====\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![GitHub go.mod Go version of a Go module](https://img.shields.io/github/go-mod/go-version/mono83/maybe.svg)](https://github.com/mono83/maybe)\n[![GoDoc reference example](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/mono83/maybe)\n[![Go Report Card](https://goreportcard.com/badge/github.com/mono83/maybe)](https://goreportcard.com/report/github.com/mono83/maybe)\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/mono83/maybe/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/mono83/maybe/tree/main)\n\nSimple zero dependency struct-based generic monad implementation in Go.\n\n## Installation\n\n```bash\ngo get -u github.com/mono83/maybe\n```\n\n## Usage\n\n### Instantiation\n\nThere are two main ways to create `maybe.Maybe` monadic container - it is either call to `maybe.Nothing()` or \n`maybe.Just(value)`. First will create empty monad, while second one will produce not empty monad with given value. \n\nPay attention, that `maybe.Just` does not verify content of passed value, so constructions like \n`maybe.Just[error](nil)` can create not empty monads with nil value within. To avoid this behaviour use \n`maybe.Nilable`, that will perform `nil` check of given value.\n\nIn addition to raw instantiation, this library provide mapping constructor `maybe.Map`, able to convert \n`Maybe` from one type to another using mapping function\n\n```go\nn := maybe.Nothing[string]()    // String type, but empty\ni := maybe.Just(1)              // Int type\ns := maybe.Map(i, strconv.Itoa) // String type\n```\n\n### JSON\n\nJSON bindings can be accessed using `github.com/mono83/maybe/json` package:\n\n```go\nimport \"github.com/mono83/maybe/json\"\n\ntype Request struct {\n\tID       int\n\tParentID json.Maybe[int]\n}\n\n```\n\n### Benchmarks\n\n```\n$ go test -bench=. -benchmem\ngoos: linux\ngoarch: amd64\npkg: github.com/mono83/maybe\ncpu: Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz\nBenchmarkNothing-12             1000000000               0.2704 ns/op          0 B/op          0 allocs/op\nBenchmarkJust-12                904382658                1.313 ns/op           0 B/op          0 allocs/op\nBenchmarkPtr-12                 1000000000               1.051 ns/op           0 B/op          0 allocs/op\nBenchmarkPtrNil-12              755984685                1.578 ns/op           0 B/op          0 allocs/op\nBenchmarkNilableInt-12          72761029                16.37 ns/op            8 B/op          0 allocs/op\nBenchmarkNilableNil-12          275986280                4.157 ns/op           0 B/op          0 allocs/op\nPASS\nok      github.com/mono83/maybe 6.931s\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmono83%2Fmaybe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmono83%2Fmaybe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmono83%2Fmaybe/lists"}