Skip to main content

src/mesv.erl

-module(mesv).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src\\mesv.gleam").
-export([parsed/1]).

-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.

?MODULEDOC(
    " A CSV parsing library that strongly enforces Data Integrity, allows for creation of both\n"
    " a formatter (`fn(data) -> String`) and parser (`fn(String) -> data`) from the same\n"
    " data type, and allows the user to add Frontmatter metadata to CSV files.\n"
    " \n"
    " This root module is rather barren, as most of the relevant functionality is categorized\n"
    " into the two modules, `mesv.format` and `mesv.parse`.\n"
).

-file("src\\mesv.gleam", 29).
?DOC(
    " A subset of an identity function for 1-arity functions.\n"
    " \n"
    " Meant to be used in the `build` function with `use` statements, like so:\n"
    " ```gleam\n"
    " mesv.parse.build({\n"
    "   use player <- mesv.parsed\n"
    "   use score <- mesv.parsed\n"
    "   #(player, score)\n"
    " })\n"
    " ```\n"
    " To clarify, the above code is equivalent to:\n"
    " ```gleam\n"
    " mesv.parse.build({\n"
    "   fn(player) {\n"
    "     fn(score) {\n"
    "       #(player, score)\n"
    "     }\n"
    "   }\n"
    " })\n"
    " ```\n"
).
-spec parsed(fun((DKT) -> DKU)) -> fun((DKT) -> DKU).
parsed(F) ->
    F.