{"id":13800530,"url":"https://github.com/athanclark/purescript-arraybuffer-class","last_synced_at":"2026-02-06T18:01:47.391Z","repository":{"id":51890998,"uuid":"162048585","full_name":"athanclark/purescript-arraybuffer-class","owner":"athanclark","description":"Simple encoding / decoding classes for ArrayBuffers","archived":false,"fork":false,"pushed_at":"2021-05-09T06:43:30.000Z","size":55,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-20T02:08:28.083Z","etag":null,"topics":["arraybuffer","generics","purescript","typeclass"],"latest_commit_sha":null,"homepage":null,"language":"PureScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/athanclark.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-12-16T22:55:23.000Z","updated_at":"2020-10-16T18:56:15.000Z","dependencies_parsed_at":"2022-08-23T13:12:23.841Z","dependency_job_id":null,"html_url":"https://github.com/athanclark/purescript-arraybuffer-class","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/athanclark/purescript-arraybuffer-class","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athanclark%2Fpurescript-arraybuffer-class","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athanclark%2Fpurescript-arraybuffer-class/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athanclark%2Fpurescript-arraybuffer-class/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athanclark%2Fpurescript-arraybuffer-class/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/athanclark","download_url":"https://codeload.github.com/athanclark/purescript-arraybuffer-class/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athanclark%2Fpurescript-arraybuffer-class/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265277636,"owners_count":23739425,"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":["arraybuffer","generics","purescript","typeclass"],"created_at":"2024-08-04T00:01:13.459Z","updated_at":"2026-02-06T18:01:42.369Z","avatar_url":"https://github.com/athanclark.png","language":"PureScript","readme":"# purescript-arraybuffer-class\n\n[![Build Status](https://travis-ci.org/athanclark/purescript-arraybuffer-class.svg?branch=master)](https://travis-ci.org/athanclark/purescript-arraybuffer-class)\n[![Pursuit](https://pursuit.purescript.org/packages/purescript-arraybuffer-class/badge)](https://pursuit.purescript.org/packages/purescript-arraybuffer-class)\n\nTypeclasses for binary serialization in PureScript.\n\n\u003e Note: Although this library shares a lot of features similar to the [cereal library from Haskell](https://hackage.haskell.org/package/cereal), it is not yet compatible.\n\n## Usage\n\nIt should feel fairly similar to [Argonaut](https://pursuit.purescript.org/package/purescript-argonaut), but with a\nbinary spin on things - everything is very `Effect`-ful, and will throw errors if something doesn't line-up as expected.\n\nJust implement the `EncodeArrayBuffer` and `DecodeArrayBuffer` typeclasses to support binary serialization for\nyour data type.\n\n## Notes\n\n- The `Array` instance first packs its length as a 4-byte `Uint32BE` - I don't know of a perfect way around this\n  without excessive testing.\n- The `Char` and `CodePoint` instances seem to reflect utf-8 pretty decently - Woo Hoo! Pure utf-8 serialization!! But wait...\n- The `String` instance just turns it into an `Array CodePoint`, so there's an initial word denoting the string's length.\n  Right now, I don't know of a clean way around this, without making every instance have a length argument.\n- The `Vec` instance actually sidesteps the length argument, because the length is assumed to be known at compile-time.\n- The `ArrayBuffer`, `DataView`, and `ArrayView` instances also have a similar initial length argument. Writing\n  is not as efficient as you'd hope.\n- The `Record` instance first turns the record into an `Object ArrayBuffer`, which then becomes a\n  `Array (Tuple String ArrayBuffer)` - it's not super efficient.\n- The `Generic` instances treat every `Sum` as its own distinguished, isolated possability - for data types with\n  multiple consecutive sum values, like `These` or `Ordering`, it's suggested to write your own instance to pack\n  each sum constructor as its own flag in the byte range `0 - 255`. `Sum`s are treated like `Either` - only `0` and\n  `1` are used.\n","funding_links":[],"categories":["Binary Serialization"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fathanclark%2Fpurescript-arraybuffer-class","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fathanclark%2Fpurescript-arraybuffer-class","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fathanclark%2Fpurescript-arraybuffer-class/lists"}