package delimited_parsing

  1. Overview
  2. Docs
Parsing of character (e.g., comma) separated and fixed-width values

Install

Dune Dependency

Authors

Maintainers

Sources

delimited_parsing-v0.13.0.tar.gz
sha256=29e28ef831de65243c31b377c3fb6fed1f048589b01b7c4cb4bb8fadeb39d872
md5=dd29a3b04015352543715bb3aae5405d

Description

Delimited_parsing parses character-separated values (such as CSV files) and fixed-width records.

Published: 20 Nov 2019

README

Delimited

This library contains parsers & generators for CSVs (and CSV-like delimited formats). It additionally contains some non-csv format parsers.

Reading CSVs

The Delimited.Read module contains two mechanisms for reading CSVs:

  • The applicative interface. This interface has a small learning curve but produces clean, composable and type-safe parsers for the 'a of your choice.

  • Using the pre-built Row object & requesting headers/indices directly. This is a more obvious interface but provides little protection against programmer error.

In new code you should favour the applicative interface (it's like Command.Param). See the example under example/ or ask a delimited dev for help if you're not familiar.

Writing CSVs

The Delimited.Write module contains two mechanisms for writing CSVs:

  • The main interface. Like the applicative interface for reading CSVs, this protects fairly well against programmer error and provides clean, composable and type-safe CSV generators for the 'a of your choice.

  • The row-based interface takes string lists and formats them as CSVs. There are no checks that you have the correct number or order of columns.

New code should prefer the builder interface. There's an example under example/ or you can ask a delimited dev for help.

(Technical note: the main writer interface is not an applicative functor.)

Non-CSV parsers

There are two non-csv formats supported for parsing:

  • Non_csv.character_separated_without_quoting: like CSVs but no field may contain newlines or the delimiter character as there is no quoting

  • Non_csv.Positional: parses fixed-width fields

Dependencies (6)

  1. dune >= "1.5.1"
  2. ppx_jane >= "v0.13" & < "v0.14"
  3. core_extended >= "v0.13" & < "v0.14"
  4. core >= "v0.13" & < "v0.14"
  5. async >= "v0.13" & < "v0.14"
  6. ocaml >= "4.08.0"

Dev Dependencies

None

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.