{"id":23508726,"url":"https://github.com/lovasko/comma","last_synced_at":"2025-08-10T23:37:47.110Z","repository":{"id":62435736,"uuid":"78738464","full_name":"lovasko/comma","owner":"lovasko","description":"CSV Parser \u0026 Producer","archived":false,"fork":false,"pushed_at":"2017-02-07T17:14:01.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-17T14:39:41.894Z","etag":null,"topics":["csv","haskell","parsing","rfc-4180","text"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lovasko.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":"2017-01-12T11:23:32.000Z","updated_at":"2017-01-16T02:59:43.000Z","dependencies_parsed_at":"2022-11-01T21:30:35.054Z","dependency_job_id":null,"html_url":"https://github.com/lovasko/comma","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/lovasko/comma","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovasko%2Fcomma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovasko%2Fcomma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovasko%2Fcomma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovasko%2Fcomma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lovasko","download_url":"https://codeload.github.com/lovasko/comma/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovasko%2Fcomma/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269807653,"owners_count":24478490,"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-08-10T02:00:08.965Z","response_time":71,"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":["csv","haskell","parsing","rfc-4180","text"],"created_at":"2024-12-25T11:31:46.935Z","updated_at":"2025-08-10T23:37:47.084Z","avatar_url":"https://github.com/lovasko.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Text.Comma\n[![Build Status](https://travis-ci.org/lovasko/comma.svg?branch=master)](https://travis-ci.org/lovasko/comma)\n\nThe `comma` package implements parsing and producing of the CSV format.\n\n## Build \u0026 install\nThere are two standard ways of obtaining the module:\n * by cloning the git repository: `git clone https://github.com/lovasko/comma`\n * by using the central Hackage server: `cabal install comma`\n\n### Dependencies\nMain part, the library itself, depends on two packages:\n * `attoparsec`\n * `text`\n\nIn addition, the testing component of the project depends on the `QuickCheck`\npackage.\n\n## API\nThe `Text.Comma` module exports only two functions: `comma` and `uncomma`,\nparsing and producing CSV respectively. The function prototypes are as follows:\n\n```haskell\n-- | Parse a block of text into a CSV table.\ncomma :: T.Text                   -- ^ CSV text\n      -\u003e Either String [[T.Text]] -- ^ error | table\n```\n\n```haskell\n-- | Render a table of texts into a valid CSV output.\nuncomma :: [[T.Text]] -- ^ table\n        -\u003e T.Text     -- ^ CSV text\n```\n\n### Example\nThe following example loads any CSV file and prepends a column that contains\nrow numbers:\n\n```haskell\n{-# LANGUAGE OverloadedStrings #-}\n\nimport Text.Comma\nimport System.Exit\nimport qualified Data.Text as T\nimport qualified Data.Text.IO as T\n\n-- | Prepend a number in front of each row.\nnumber :: [[T.Text]] -\u003e [[T.Text]]\nnumber = zipWith (:) (map (T.pack . show) [0..])\n\nmain :: IO ()\nmain = T.readFile \"table.csv\" \u003e\u003e= (\\file -\u003e case comma file of\n  Left  err -\u003e T.putStrLn (\"ERROR: \" \u003c\u003e T.pack err)           \u003e\u003e exitFailure\n  Right csv -\u003e T.writeFile \"table.csv\" (uncomma $ number csv) \u003e\u003e exitSuccess)\n```\n\nExample usage:\n```bash\n$ cat table.csv\nname,surname,language\nDennis,Ritchie,C\nLarry,Wall,Perl\nJohn,McCarthy,Lisp\n$ ./number \u0026\u0026 cat table.csv\n0,name,surname,language\n1,Dennis,Ritchie,C\n2,Larry,Wall,Perl\n3,John,McCarthy,Lisp\n```\n\n## Standards\nBoth producing and parsing of CSV files closely follows the\n[RFC4180](https://tools.ietf.org/html/rfc4180) document. The `comma`\nimplementation has made the following decisions:\n * record separator is always only `\\n` ('\\r` is not recognized as a newline\n   symbol)\n * it is not required for the last record to be trailed with a `\\n`. This\n   means that `comma \"hello\\nworld\" == comma \"hello\\nworld\\n\" == Right\n   [[\"hello\"], [\"world\"]]`\n\n## License\nThe `comma` package is licensed under the terms of the [2-clause BSD\nlicense](LICENSE). In case you need any other license, feel free to contact the\nauthor.\n\n## Author\nDaniel Lovasko \u003cdaniel.lovasko@gmail.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovasko%2Fcomma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flovasko%2Fcomma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovasko%2Fcomma/lists"}