Turns an instance of CsvInput[S]
into one of CsvInput[T]
.
Turns an instance of CsvInput[S]
into one of CsvInput[T]
.
This allows developers to adapt existing instances of CsvInput rather than write one from scratch.
One could, for example, write CsvInput[URL]
by basing it on CsvInput[InputStream]
:
val urlInput: CsvInput[URL] = CsvInput[InputStream].contramap((url: URL) => url.openStream())
Turns the specified S
into an iterator on DecodeResult[A]
.
Turns the specified S
into an iterator on DecodeResult[A]
.
This method is "safe", in that it does not throw exceptions when errors are encountered. This comes with the small cost of having each row wrapped in a DecodeResult that then need to be unpacked. See unsafeReader for an alternative.
This method is also mapped to the asCsvRows
one that enrich all types that have a valid CsvInput instance
in scope. For example:
implicit val strInput: CsvInput[String] = ??? "a,b,c".asCsvRows[List[Char]](',', false)
type to parse each row as.
Turns the specified S
into an iterator on A
.
Turns the specified S
into an iterator on A
.
This is the "unsafe" version of reader: it will throw as soon as an error is encountered.
type to parse each row as.
Turns instances of
S
into valid sources of CSV data.Any type
S
that has a implicit instance of CsvInput in scope will be enriched by theasCsvReader
andasUnsafeCsvReader
methods (which map to reader and unsafeReader respectively).See the companion object for default implementations and construction methods.