{"id":22616196,"url":"https://github.com/kmcginnes/spicytaco.maybe","last_synced_at":"2026-07-14T19:31:45.679Z","repository":{"id":28320539,"uuid":"31833486","full_name":"kmcginnes/SpicyTaco.Maybe","owner":"kmcginnes","description":"NullReferenceExceptions are the root of all evil. Slay them for good with SpicyTaco.Maybe.","archived":false,"fork":false,"pushed_at":"2019-06-02T21:39:41.000Z","size":103,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-03T10:46:33.611Z","etag":null,"topics":["c-sharp","maybe","monad","null","optionals"],"latest_commit_sha":null,"homepage":"","language":"C#","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/kmcginnes.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"License.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-08T00:47:52.000Z","updated_at":"2019-06-02T21:39:43.000Z","dependencies_parsed_at":"2022-08-17T17:15:20.864Z","dependency_job_id":null,"html_url":"https://github.com/kmcginnes/SpicyTaco.Maybe","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmcginnes%2FSpicyTaco.Maybe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmcginnes%2FSpicyTaco.Maybe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmcginnes%2FSpicyTaco.Maybe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmcginnes%2FSpicyTaco.Maybe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kmcginnes","download_url":"https://codeload.github.com/kmcginnes/SpicyTaco.Maybe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246122245,"owners_count":20726822,"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":["c-sharp","maybe","monad","null","optionals"],"created_at":"2024-12-08T19:11:29.830Z","updated_at":"2025-10-20T07:41:40.695Z","avatar_url":"https://github.com/kmcginnes.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"SpicyTaco.Maybe [![Build status](https://img.shields.io/teamcity/http/teamcity.krismcginnes.com:8084/s/SpicyTacoMaybe_Build.svg?style=flat-square)](http://teamcity.krismcginnes.com:8084/viewType.html?buildTypeId=SpicyTacoMaybe_Build\u0026guest=1) [![NuGet Prerelease Version](https://img.shields.io/nuget/vpre/SpicyTaco.Maybe.svg?style=flat-square)](https://www.nuget.org/packages/SpicyTaco.Maybe/) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](License.md)\n===============\n\n## 🚨 No longer maintained. 🚨\n\nBad news. I have moved on to an entirely different platform (iOS/Swift) and will no longer be maintaining this library.\n\nThe good news is that Microsoft is introducing nullable reference types in C# 8. That should make libraries like this one less important. Although, I believe that they still have a place.\n\n## Introduction\n\nNo one likes NullReferenceExceptions. Let's change things. Let consumers of your code know when a return value might be empty. Force them to acknowledge a possible lack of value.\n\nMy goal is to make `Maybe` as easy to use as possible, but also force the consuming code down the path of success. I'm doing this by not including _nice to have_ features such as implicit conversions, `.HasValue` or `.Value`, etc.\n\n## Usage\n\nWhen you're returning a value that might be null, follow this style:\n\n```c#\npublic Maybe\u003cPerson\u003e GetPersonByName(string firstName, string lastName)\n{\n  var person = _database.People\n    .Where(x =\u003e x.FirstName == firstName \u0026\u0026 x.LastName == lastName)\n    .FirstOrDefault()\n    .ToMaybe();\n  return person;\n}\n```\n\nYou're consumer will only be able to execute code on the value through accessor methods:\n\n```c#\nGetPersonByName(\"John\", \"Doe\")\n  .Do(person =\u003e SomeUsefulAction(person))\n  .DoWhenEmpty(() =\u003e this.Log().Warn(\"No user named 'John Doe' could be found.\"));\n```\n\n## Install\n\nYou're welcome to install this library, but keep in mind it is a pre-release. I'm still plying with the API surface. Things might get renamed or dissapeared.\n\n```\nInstall-Package SpicyTaco.Maybe -Pre\n```\n\n## License\n\nI've licensed this under MIT License. That means do what you want with this code.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkmcginnes%2Fspicytaco.maybe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkmcginnes%2Fspicytaco.maybe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkmcginnes%2Fspicytaco.maybe/lists"}