{"id":28322460,"url":"https://github.com/zhaskell/z-data","last_synced_at":"2025-07-09T09:17:06.426Z","repository":{"id":47214929,"uuid":"290719249","full_name":"ZHaskell/z-data","owner":"ZHaskell","description":"array, slices and text","archived":false,"fork":false,"pushed_at":"2024-06-28T09:53:03.000Z","size":1023,"stargazers_count":70,"open_issues_count":4,"forks_count":11,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-07-03T22:18:12.662Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","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/ZHaskell.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-27T08:23:50.000Z","updated_at":"2024-06-28T09:51:16.000Z","dependencies_parsed_at":"2023-01-23T00:45:22.885Z","dependency_job_id":null,"html_url":"https://github.com/ZHaskell/z-data","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/ZHaskell/z-data","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZHaskell%2Fz-data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZHaskell%2Fz-data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZHaskell%2Fz-data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZHaskell%2Fz-data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZHaskell","download_url":"https://codeload.github.com/ZHaskell/z-data/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZHaskell%2Fz-data/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264428787,"owners_count":23606692,"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":[],"created_at":"2025-05-25T14:09:58.812Z","updated_at":"2025-07-09T09:17:06.420Z","avatar_url":"https://github.com/ZHaskell.png","language":"Haskell","funding_links":["https://opencollective.com/zhaskell/donate"],"categories":[],"sub_categories":[],"readme":"## Z-Data\n\n[![Hackage](https://img.shields.io/hackage/v/Z-Data.svg?style=flat)](https://hackage.haskell.org/package/Z-Data)\n[![Linux Build Status](https://github.com/ZHaskell/z-data/workflows/ubuntu-ci/badge.svg)](https://github.com/ZHaskell/z-data/actions)\n[![macOS Build Status](https://github.com/ZHaskell/z-data/workflows/osx-ci/badge.svg)](https://github.com/ZHaskell/z-data/actions)\n[![Windows Build Status](https://github.com/ZHaskell/z-data/workflows/win-ci/badge.svg)](https://github.com/ZHaskell/z-data/actions)\n[![ARM Build Status](https://img.shields.io/drone/build/ZHaskell/z-data?label=arm-ci)](https://cloud.drone.io/ZHaskell/z-data)\n[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.svg)](https://gitter.im/Z-Haskell/community)\n\u003ca href=\"https://opencollective.com/zhaskell/donate\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://opencollective.com/zhaskell/donate/button@2x.png?color=blue\" width=128 /\u003e\n\u003c/a\u003e\n\nThis package is part of [ZHaskell](https://z.haskell.world) project, providing basic data structures and functions:\n\n* Array, vector(array slice), sorting, searching\n* Text based UTF-8, basic unicode manipulating, regex\n* FFI utilties\n* Fast parsing and building monad\n* JSON encoding and decoding\n\n## Requirements\n\n* A working haskell compiler system, GHC(\u003e=9.2), cabal-install(\u003e=3.8), here're some options:\n    * Using [ghcup](https://www.haskell.org/ghcup/) to setup your haskell envrionment.\n* A working C/C++ compiler support C++11, here're some options:\n    * Mac users can use the `clang` comes with the [XCode](https://developer.apple.com/xcode/) or [XCode Command Line Tools](https://developer.apple.com/downloads):\n        * You can install XCode from app store, or XCode Command Line Tools with `sudo xcode-select --install`.\n        * If you came across compiling issues like [this](https://stackoverflow.com/questions/58628377/catalina-c-using-cmath-headers-yield-error-no-member-named-signbit-in-th), consider removing redundant SDKs, e.g. `sudo rm -rf /Library/Developer/CommandLineTools/SDKs`\n    * Windows users can use the mingw's one comes with GHC, you can use it by adding `your_path_to_ghc\\mingw\\bin` to your `PATH`.\n    * Ubuntu users can install `gcc/g++` by running `sudo apt install build-essential`.\n* Tests need [hspec-discover](https://hackage.haskell.org/package/hspec-discover).\n\n## Example usage\n\n```haskell\n\u003e import qualified Z.Data.Vector as V\n\u003e import qualified Z.Data.Array as A\n\u003e\n\u003e -- convert from list\n\u003e let v = V.pack [1..10] :: V.PrimVector Int\n\u003e -- vector combinators works on arrays as well\n\u003e let a = V.pack [1..10] :: A.Array Int\n\u003e -- slicing vector(slice) is O(1)\n\u003e V.take 3 v\n[1,2,3]\n-- slicing array is not O(1)\n\u003e V.drop 3 a\nfromListN 7 [4,5,6,7,8,9,10]\n\u003e\n\u003e V.intersperse 10 v\n[1,10,2,10,3,10,4,10,5,10,6,10,7,10,8,10,9,10,10]\n\u003e\n\u003e V.mergeSort (V.intersperse 10 v)\n[1,2,3,4,5,6,7,8,9,10,10,10,10,10,10,10,10,10,10]\n\u003e -- Generic KMP search on vectors\n\u003e V.indices (V.singleton 10) (V.intersperse 10 v) True\n[1,3,5,7,9,11,13,15,17,18]\n\u003e\n\u003e -- quoter for writing numeric vector literals\n\u003e :set -XQuasiQuotes\n\u003e :t [V.vecWord|1,2,3,4,5,4,3,2,1|]\n[V.vecWord|1,2,3,4,5,4,3,2,1|] :: V.PrimVector Word\n\u003e\n\u003e import qualified Z.Data.Builder as B\n\u003e import qualified Z.Data.Text as T\n\u003e :set -XOverloadedStrings\n\u003e\n\u003e -- Builders can be used with OverloadedStrings\n\u003e B.build $ \"builders: \" \u003e\u003e B.hex (3 :: Word16) \u003e\u003e B.comma \u003e\u003e B.double 1.2345678\n[98,117,105,108,100,101,114,115,58,32,48,48,48,51,44,49,46,50,51,52,53,54,55,56]\n\u003e\n\u003e B.buildText $ \"builders: \" \u003e\u003e B.hex (3 :: Word16) \u003e\u003e B.comma \u003e\u003e B.double 1.2345678\n\"builders: 0003,1.2345678\"\n\u003e\n\u003e import qualified Z.Data.JSON as JSON\n\u003e import GHC.Generics\n\u003e\n\u003e JSON.parseValue \"[1,2,3,4,5]\"\n([],Right (Array [Number 1.0,Number 2.0,Number 3.0,Number 4.0,Number 5.0]))\n\u003e\n\u003e -- JSON module support deriving through Generic\n\u003e :set -XDeriveAnyClass -XDeriveGeneric\n\u003e data Foo = Foo {foo :: Double} deriving (JSON.JSON, Generic)\n\u003e JSON.toValue (Foo 0.01)\nObject [(\"foo\",Number 1.0e-2)]\n\u003e JSON.encodeText (Foo 0.01)\n\"{\\\"foo\\\":1.0e-2}\"\n```\n\n## Dev guide\n\n```bash\n# get code\ngit clone --recursive git@github.com:ZHaskell/z-data.git\ncd z-data\n# build\ncabal build\n# test\ncabal test --test-show-details=direct\n# install\ncabal install\n# generate document\ncabal haddock\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhaskell%2Fz-data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhaskell%2Fz-data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhaskell%2Fz-data/lists"}