{"id":15010941,"url":"https://github.com/michaeljklein/prim-spoon","last_synced_at":"2026-02-14T13:02:56.463Z","repository":{"id":56875383,"uuid":"57905622","full_name":"michaeljklein/prim-spoon","owner":"michaeljklein","description":"'Spoon' errors to `Maybe` in Haskell, with primops","archived":false,"fork":false,"pushed_at":"2017-11-22T20:55:57.000Z","size":917,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-18T16:57:59.335Z","etag":null,"topics":["exception-handling","ghc","haskell","performance","primitives"],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaeljklein.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":"2016-05-02T16:56:47.000Z","updated_at":"2017-03-08T22:15:55.000Z","dependencies_parsed_at":"2022-08-20T10:11:03.506Z","dependency_job_id":null,"html_url":"https://github.com/michaeljklein/prim-spoon","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/michaeljklein/prim-spoon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeljklein%2Fprim-spoon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeljklein%2Fprim-spoon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeljklein%2Fprim-spoon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeljklein%2Fprim-spoon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaeljklein","download_url":"https://codeload.github.com/michaeljklein/prim-spoon/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeljklein%2Fprim-spoon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276135191,"owners_count":25591185,"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","status":"online","status_checked_at":"2025-09-20T02:00:10.207Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["exception-handling","ghc","haskell","performance","primitives"],"created_at":"2024-09-24T19:37:40.273Z","updated_at":"2025-09-25T18:55:02.327Z","avatar_url":"https://github.com/michaeljklein.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prim-Spoon\n\n[![Build Status](https://travis-ci.org/michaeljklein/prim-spoon.png)](https://travis-ci.org/michaeljklein/prim-spoon)\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/ed4eb647c76f41f7bd004572502ebeda)](https://www.codacy.com/app/michaeljklein/prim-spoon?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=michaeljklein/prim-spoon\u0026amp;utm_campaign=Badge_Grade)\n\n[![Hackage](https://img.shields.io/hackage/v/lens.svg)](https://hackage.haskell.org/package/prim-spoon-0.1.0)\n\n\nOn hackage as [prim-spoon](https://hackage.haskell.org/package/prim-spoon-0.1.0)\n\nThis is a microproject for the sole purpose of having a high-performance \nversion of `teaspoon` from [Control.Spoon](http://hackage.haskell.org/package/spoon-0.3.1), using primops.\nWhile it is unsafe, it is as safe as `catch#` and `seq#` from [GHC.Prim](https://hackage.haskell.org/package/ghc-prim-0.4.0.0/candidate/docs/GHC-Prim.html).\n(I'd look into how safe those are, but they're hidden in GHC's source and that _really_ seems like overkill.)\n\nCurrent [benchmarks](https://rawgit.com/michaeljklein/prim-spoon/master/benchmarks.html)\nsuggest that `primspoon` takes about 3x as long as a function call on non-error \nthrowing values and about 5x as long to catch an error and return `Nothing`. \nThis is an improvment over `teaspoon`, which takes about 4x as long as a\nfunction call on a non-error value and about 21x to catch an error.\n\nWhy bother? Three reasons: \n\n1. This is my first experience with digging into primops in Haskell for performance, and it was a good exercise.\n2. I had begun to roll my own solution before I found `Control.Spoon` and wanted to benchmark several different solutions (for example, `makeStableName`).\n3. I was curious how `unsafePerformIO` affects performance. It turns out that it takes longer than I expected, but it makes some sense as it's not the best thing to spend time optimizing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaeljklein%2Fprim-spoon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaeljklein%2Fprim-spoon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaeljklein%2Fprim-spoon/lists"}