{"id":24551902,"url":"https://github.com/mlabs-haskell/purescript-cardano-plutus-data-schema","last_synced_at":"2026-02-09T18:33:23.693Z","repository":{"id":218985997,"uuid":"747864020","full_name":"mlabs-haskell/purescript-cardano-plutus-data-schema","owner":"mlabs-haskell","description":"Type-level schemas that let one define PlutusData encodings for PureScript algebraic data types","archived":false,"fork":false,"pushed_at":"2026-01-25T12:48:53.000Z","size":63,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2026-01-26T04:15:13.145Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PureScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mlabs-haskell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-01-24T19:42:36.000Z","updated_at":"2024-07-08T14:00:52.000Z","dependencies_parsed_at":"2024-01-24T21:25:07.802Z","dependency_job_id":"f9d8239c-1726-42a6-bf2f-003c32a2391d","html_url":"https://github.com/mlabs-haskell/purescript-cardano-plutus-data-schema","commit_stats":null,"previous_names":["mlabs-haskell/purescript-cardano-plutus-data-schema"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mlabs-haskell/purescript-cardano-plutus-data-schema","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlabs-haskell%2Fpurescript-cardano-plutus-data-schema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlabs-haskell%2Fpurescript-cardano-plutus-data-schema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlabs-haskell%2Fpurescript-cardano-plutus-data-schema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlabs-haskell%2Fpurescript-cardano-plutus-data-schema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlabs-haskell","download_url":"https://codeload.github.com/mlabs-haskell/purescript-cardano-plutus-data-schema/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlabs-haskell%2Fpurescript-cardano-plutus-data-schema/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29275702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T17:15:22.002Z","status":"ssl_error","status_checked_at":"2026-02-09T17:14:42.395Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":[],"created_at":"2025-01-23T01:19:23.382Z","updated_at":"2026-02-09T18:33:23.678Z","avatar_url":"https://github.com/mlabs-haskell.png","language":"PureScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# purescript-cardano-plutus-data-schema\n\nThis package implements type-level machinery that we use across the [`cardano-transaction-lib`](https://github.com/Plutonomicon/cardano-transaction-lib/) ecosystem to specify  `PlutusData` encodings for arbitrary algebraic data types.\n\nIt is similar in spirit to [`PlutusTx.makeIsDataIndexed`](https://github.com/IntersectMBO/plutus/blob/eceae8831b8186655535dee587486dbd3fd037f4/plutus-ledger-api/src/PlutusLedgerApi/V1/Credential.hs#L78) from Plutus, which is implemented in TemplateHaskell.\n\nIn PureScript, we couldn't use TemplateHaskell-style codegen due to the lack of it, and we couldn't rely on the ordering of record fields and constructors in ADTs when using `Generic` machinery, because PureScript always sorts them alphabetically. So, this module was invented to fix the ordering when deriving instances via `Generic`.\n\n## Example\n\nA quick usage example (`S` and `Z` are for type-level [Peano numbers](https://wiki.haskell.org/Peano_numbers)):\n\n```purescript\ndata FType\n  = F0\n      { f0A :: BigInt\n      }\n  | F1\n      { f1A :: Boolean\n      , f1B :: Boolean\n      , f1C :: Boolean\n      }\n  | F2\n      { f2A :: BigInt\n      , f2B :: FType\n      }\n\ninstance\n  HasPlutusSchema FType\n    ( \"F0\" :=\n          ( \"f0A\" := I BigInt\n          :+ PNil)\n       @@ Z\n\n    :+ \"F1\" :=\n          ( \"f1A\"  := I Boolean\n          :+ \"f1B\" := I Boolean\n          :+ \"f1C\" := I Boolean\n          :+ PNil\n          )\n        @@ (S Z)\n\n    :+ \"F2\" :=\n          (  \"f2A\" := I BigInt\n          :+ \"f2B\" := I FType\n          :+ PNil\n          )\n        @@ (S (S Z))\n\n    :+ PNil\n    )\n\n\ninstance ToData FType where\n  toData = genericToData\n\ninstance FromData FType where\n  fromData = genericFromData\n```\n\nFor more examples, see [the test suite of `purescript-plutus-types`](https://github.com/mlabs-haskell/purescript-plutus-types/blob/f454204cccffe94db1c097949a663ea897c41cf3/test/Main.purs#L147)\n\n## Testing\n\nThe tests for this package are located in [`purescript-cardano-types`](https://github.com/mlabs-haskell/purescript-plutus-types/blob/master/test/Main.purs)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlabs-haskell%2Fpurescript-cardano-plutus-data-schema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlabs-haskell%2Fpurescript-cardano-plutus-data-schema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlabs-haskell%2Fpurescript-cardano-plutus-data-schema/lists"}