{"id":21409834,"url":"https://github.com/stackbuilders/cassava-megaparsec","last_synced_at":"2025-07-14T02:30:48.417Z","repository":{"id":9305541,"uuid":"61551350","full_name":"stackbuilders/cassava-megaparsec","owner":"stackbuilders","description":"Megaparsec parser of CSV files that plays nicely with Cassava","archived":false,"fork":false,"pushed_at":"2024-11-22T21:59:14.000Z","size":66,"stargazers_count":9,"open_issues_count":4,"forks_count":5,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-06-14T07:05:45.953Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/stackbuilders.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"docs/CODE_OF_CONDUCT.md","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}},"created_at":"2016-06-20T13:51:55.000Z","updated_at":"2024-09-17T22:39:06.000Z","dependencies_parsed_at":"2024-02-16T20:25:28.208Z","dependency_job_id":"d09534fa-7174-42af-9b18-3b4cd9eb1344","html_url":"https://github.com/stackbuilders/cassava-megaparsec","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/stackbuilders/cassava-megaparsec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbuilders%2Fcassava-megaparsec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbuilders%2Fcassava-megaparsec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbuilders%2Fcassava-megaparsec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbuilders%2Fcassava-megaparsec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackbuilders","download_url":"https://codeload.github.com/stackbuilders/cassava-megaparsec/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbuilders%2Fcassava-megaparsec/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265233753,"owners_count":23731825,"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":"2024-11-22T17:34:32.525Z","updated_at":"2025-07-14T02:30:48.074Z","avatar_url":"https://github.com/stackbuilders.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cassava Megaparsec\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\n[![License MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)\n[![Hackage](https://img.shields.io/hackage/v/cassava-megaparsec.svg?style=flat)](https://hackage.haskell.org/package/cassava-megaparsec)\n[![Stackage Nightly](http://stackage.org/package/cassava-megaparsec/badge/nightly)](http://stackage.org/nightly/package/cassava-megaparsec)\n[![Stackage LTS](http://stackage.org/package/cassava-megaparsec/badge/lts)](http://stackage.org/lts/package/cassava-megaparsec)\n![Build Status](https://github.com/stackbuilders/cassava-megaparsec/actions/workflows/build.yml/badge.svg)\n\nThe package provides alternative parser for the\n[Cassava](https://hackage.haskell.org/package/cassava) package written with\n[Megaparsec](https://hackage.haskell.org/package/megaparsec) so you can get\nbetter error messages at expense of some speed.\n\n## Quick start\n\nThe package works seamlessly with Cassava by replacing the following\nfunctions:\n\n* `decode`\n* `decodeWith`\n* `decodeByName`\n* `decodeByNameWith`\n\nThe functions work just the same as Cassava's equivalents, but also take\nname of file they parse (to include into error messages) and return typed\nhigh-quality error messages produced by\n[Megaparsec](https://hackage.haskell.org/package/megaparsec).\n\nThe import section typically looks like this:\n\n```haskell\nimport Data.Csv hiding (decode, decodeWith, decodeByName, decodeByNameWith)\nimport Data.Csv.Parser.Megaparsec (decode, decodeWith, decodeByName, decodeByNameWith)\n```\n\nNext you call appropriate function and get either result of parsing\nidentical to that of Cassava or error message. The error message is\nwell-typed so you can examine it in Haskell code easily. Conversion error\nare considered parsing errors by the `cassava-megaparsec` package and are\nreported via custom error message component `Cec` supported by Megaparsec 5.\nSince Cassava's conversion errors are plain strings, we have no choice but\nto represent them as strings too:\n\n```haskell\n-- | Custom error component for CSV parsing. It allows typed reporting of\n-- conversion errors.\n\ndata Cec\n  = CecFail String\n  | CecIndentation Ordering Pos Pos\n  | CecConversionError String\n  deriving (Eq, Data, Typeable, Ord, Read, Show)\n```\n\nTo pretty print a error message use the `parseErrorPretty` function from\n`Text.Megaparsec`.\n\nThis should be enough to start using the package, please consult Haddocks\nfor detailed per-function documentation.\n\n## Example\n\nTo check an example using `cassava-megaparsec` check the code in the `example` directory.\n\nGiven the following type:\n```haskell\ndata Test = Test {a :: Char, b :: Char, c :: Char} deriving (Eq, Show, Generic)\n```\nAnd, the following csv file:\n```text\na,ba,c\n```\nWe get the following error:\n```\nexample.csv:1:7:\n  |\n1 | a,ba,c\n  |       ^\nconversion error: expected Char, got \"ba\"\n```\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://markkarpov.com/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/8165792?v=4?s=100\" width=\"100px;\" alt=\"Mark Karpov\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMark Karpov\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/stackbuilders/cassava-megaparsec/commits?author=mrkkrp\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/cptrodolfox\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/20303685?v=4?s=100\" width=\"100px;\" alt=\"William R. Arellano\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eWilliam R. Arellano\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/stackbuilders/cassava-megaparsec/commits?author=cptrodolfox\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://cristhianmotoche.github.io/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/8370088?v=4?s=100\" width=\"100px;\" alt=\"Cristhian Motoche\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eCristhian Motoche\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/stackbuilders/cassava-megaparsec/commits?author=CristhianMotoche\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/aemartinez37\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/29762180?v=4?s=100\" width=\"100px;\" alt=\"Andrés Martínez\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAndrés Martínez\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/stackbuilders/cassava-megaparsec/commits?author=aemartinez37\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/Bodigrim\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/2293557?v=4?s=100\" width=\"100px;\" alt=\"ˌbodʲɪˈɡrʲim\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eˌbodʲɪˈɡrʲim\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/stackbuilders/cassava-megaparsec/commits?author=Bodigrim\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://g0v.social/@felixonmars\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/1006477?v=4?s=100\" width=\"100px;\" alt=\"Felix Yan\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eFelix Yan\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/stackbuilders/cassava-megaparsec/commits?author=felixonmars\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/Jagl257\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/27145248?v=4?s=100\" width=\"100px;\" alt=\"Jorge Guerra Landázuri\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJorge Guerra Landázuri\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/stackbuilders/cassava-megaparsec/commits?author=Jagl257\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://www.stackbuilders.com/news/author/justin-leitgeb\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/9977?v=4?s=100\" width=\"100px;\" alt=\"Justin S. Leitgeb\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJustin S. Leitgeb\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/stackbuilders/cassava-megaparsec/commits?author=jsl\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n## License\n\nMIT, see [the LICENSE file](LICENSE).\n\n## Contributing\n\nDo you want to contribute to this project? Please take a look at our [contributing guideline](/docs/CONTRIBUTING.md) to know how you can help us build it.\n\n---\n\u003cimg src=\"https://cdn.stackbuilders.com/media/images/Sb-supports.original.png\" alt=\"Stack Builders\" width=\"50%\"\u003e\u003c/img\u003e  \n[Check out our libraries](https://github.com/stackbuilders/) | [Join our team](https://www.stackbuilders.com/join-us/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackbuilders%2Fcassava-megaparsec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackbuilders%2Fcassava-megaparsec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackbuilders%2Fcassava-megaparsec/lists"}