+
+trait TSVFunctions extends TSVTypes {
+ def decode[A: FromRecord](tsv: StringLike[_]): Seq[A] = {
+ val lines = tsv.split('\n').filter(!_.isEmpty)
+ val header = lines.head.split('\t').map(Symbol(_))
+ val records = lines.tail.map(line => Record((header zip line.split('\t').map { Field(_) }).toMap))
+ return records.map { r =>
+ runParser(r.parseRecord[A]) match {
+ case Right(a) => a
+ case Left(e) => throw new DecodeFailedException(e)
+ }
+ }
+ }
+}
+
+object TSV extends TSVTypes with TSVFunctions