{"id":23160656,"url":"https://github.com/disruptek/badresults","last_synced_at":"2025-04-09T16:18:28.904Z","repository":{"id":78132149,"uuid":"240961904","full_name":"disruptek/badresults","owner":"disruptek","description":"a less fascist fork of nim-result","archived":false,"fork":false,"pushed_at":"2024-02-12T16:10:30.000Z","size":91,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T16:18:20.416Z","etag":null,"topics":["nim","result","results","return","type"],"latest_commit_sha":null,"homepage":"","language":"Nim","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/disruptek.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":"2020-02-16T20:35:54.000Z","updated_at":"2024-09-12T13:19:57.000Z","dependencies_parsed_at":"2024-12-17T23:11:48.411Z","dependency_job_id":"3d0f99de-2a85-4fd3-a11e-4d5561baba58","html_url":"https://github.com/disruptek/badresults","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disruptek%2Fbadresults","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disruptek%2Fbadresults/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disruptek%2Fbadresults/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disruptek%2Fbadresults/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/disruptek","download_url":"https://codeload.github.com/disruptek/badresults/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248065281,"owners_count":21041872,"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":["nim","result","results","return","type"],"created_at":"2024-12-17T23:11:36.835Z","updated_at":"2025-04-09T16:18:28.874Z","avatar_url":"https://github.com/disruptek.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"# badresults\n[![Test Matrix](https://github.com/disruptek/badresults/workflows/CI/badge.svg)](https://github.com/disruptek/badresults/actions?query=workflow%3ACI)\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/disruptek/badresults?style=flat)](https://github.com/disruptek/badresults/releases/latest)\n![Minimum supported Nim version](https://img.shields.io/badge/nim-2.0.0%2B-informational?style=flat\u0026logo=nim)\n[![License](https://img.shields.io/github/license/disruptek/badresults?style=flat)](#license)\n\n_see 2.1.x releases if you need support for an earlier Nim compiler_\n\nThis is _mostly_ a copy of an early version of [the Status nim-result\npackage](https://github.com/arnetheduck/nim-result) that differs in that you\ndo not need to provide a side-effect-free (`func`) implementation of `$` for\nall types used in your `Result`.\n\nAlso, it makes fewer uses of templates and has a narrower API to make it\nsimpler and prevent C-codegen issues experienced with `nim-result`.\n\nAlso, it supports `toException` and `$` overrides for error types which are\nimplemented in nested scopes.\n\nAlso, it might not work in Windows because I have no way to test it there.\n\nIf you care more for performance and features, use `nim-result` or ask nicely\nand maybe we add a symbol or two back in.  I personally consider compilation\na non-negotiable feature.\n\n## Documentation\nSee [the documentation for the badresults module](https://disruptek.github.io/badresults/badresults.html) as generated directly from the source.\n\nHere's the type we provide:\n```nim\nResult[T; E] = object\n  case o: bool\n  of false:\n      e: E\n  of true:\n      v: T\n```\n\n## Usage\n\nThis example is from the documentation:\n\n```nim\n# It's convenient to create an alias - most likely, you'll do just fine\n# with strings as error!\n\ntype R = Result[int, string]\n\n# Once you have a type, use `ok` and `err`:\n\nfunc works(): R =\n  # ok says it went... ok!\n  R.ok 42\nfunc fails(): R =\n  # or type it like this, to not repeat the type!\n  result.err \"bad luck\"\n\n# If you provide this exception converter, this exception will be raised\n# on dereference\nfunc toException(v: Error): ref CatchableException = (ref CatchableException)(msg: $v)\ntry:\n  get RE[int].err(a)\nexcept CatchableException:\n  echo \"in here!\"\n```\n\n## Installation\n\n```\n$ nimph clone badresults\n```\nor if you're still using Nimble like it's 2012,\n```\n$ nimble install https://github.com/disruptek/badresults\n```\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdisruptek%2Fbadresults","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdisruptek%2Fbadresults","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdisruptek%2Fbadresults/lists"}