{"id":16336438,"url":"https://github.com/justinwoo/purescript-expect-inferred","last_synced_at":"2026-01-24T07:02:12.005Z","repository":{"id":58225377,"uuid":"144282933","full_name":"justinwoo/purescript-expect-inferred","owner":"justinwoo","description":"Library for checking inferred types of values for testing","archived":false,"fork":false,"pushed_at":"2021-12-15T12:57:38.000Z","size":6,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-19T13:23:42.101Z","etag":null,"topics":["purescript"],"latest_commit_sha":null,"homepage":"","language":"PureScript","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/justinwoo.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":"2018-08-10T12:23:51.000Z","updated_at":"2021-12-15T12:56:12.000Z","dependencies_parsed_at":"2022-08-31T04:10:19.128Z","dependency_job_id":null,"html_url":"https://github.com/justinwoo/purescript-expect-inferred","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/justinwoo/purescript-expect-inferred","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinwoo%2Fpurescript-expect-inferred","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinwoo%2Fpurescript-expect-inferred/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinwoo%2Fpurescript-expect-inferred/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinwoo%2Fpurescript-expect-inferred/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justinwoo","download_url":"https://codeload.github.com/justinwoo/purescript-expect-inferred/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinwoo%2Fpurescript-expect-inferred/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28717396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T05:53:42.649Z","status":"ssl_error","status_checked_at":"2026-01-24T05:53:41.698Z","response_time":89,"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":["purescript"],"created_at":"2024-10-10T23:44:08.400Z","updated_at":"2026-01-24T07:02:11.971Z","avatar_url":"https://github.com/justinwoo.png","language":"PureScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# purescript-expect-inferred\n\n[![Build Status](https://travis-ci.org/justinwoo/purescript-expect-inferred.svg?branch=master)](https://travis-ci.org/justinwoo/purescript-expect-inferred)\n\nLibrary for when you want to expect that something is inferred correctly. This library is not commonly useful.\n\n## How this works\n\n```purs\nclass ExpectInferred expected actual\n```\n\nNo fundeps, so both have to be determined to match anything, which means that in PureScript, you have to let-bind your intermediate actual results.\n\n```purs\nexpectInferred\n  :: forall expected actual\n   . ExpectInferred expected actual\n  =\u003e Proxy expected\n  -\u003e actual\n  -\u003e Unit\nexpectInferred _ _ = unit\n```\n\n## Usage\n\nGiven some class and some of its methods:\n\n```purs\nclass SimpleClass a b | a -\u003e b where\n  simpleMethod :: Proxy a -\u003e b\n\ninstance simpleInstance1 :: SimpleClass Int String where\n  simpleMethod _ = \"hello\"\n\ninstance simpleInstance2 :: SimpleClass String Unit where\n  simpleMethod _ = unit\n```\n\nWe can see usage as expected:\n\n```purs\ntest1 :: Unit\ntest1 =\n  let\n    expectedP = Proxy :: Proxy String\n    simpleValue = simpleMethod (Proxy :: Proxy Int)\n  in\n    expectInferred expectedP simpleValue\n```\n\nThen, when we put the wrong thing in:\n\n```purs\ntest2 :: Unit\ntest2 =\n  let\n    -- this will error correctly:\n    expectedP = Proxy :: Proxy String\n    -- A custom type error occurred while solving type class constraints:\n    --\n    --   The expected (first) and actual (second) types did not match:\n    --     String\n    --     Unit\n    --\n    -- while applying a function expectInferred\n    --   of type ExpectInferred t0 t1 =\u003e Proxy t0 -\u003e t1 -\u003e Unit\n    --   to argument expectedP\n    -- while inferring the type of expectInferred expectedP\n    -- in value declaration test2\n\n    simpleValue = simpleMethod (Proxy :: Proxy String)\n  in\n    expectInferred expectedP simpleValue\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinwoo%2Fpurescript-expect-inferred","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustinwoo%2Fpurescript-expect-inferred","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinwoo%2Fpurescript-expect-inferred/lists"}