summaryrefslogtreecommitdiffstats
path: root/lib/ingcsv.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ingcsv.ml')
-rw-r--r--lib/ingcsv.ml18
1 files changed, 1 insertions, 17 deletions
diff --git a/lib/ingcsv.ml b/lib/ingcsv.ml
index 53258fe..edb8aaa 100644
--- a/lib/ingcsv.ml
+++ b/lib/ingcsv.ml
@@ -1,6 +1,5 @@
1open Core 1open Prelude
2open Result.Let_syntax 2open Result.Let_syntax
3module Time_ns = Time_ns_unix
4 3
5module Debit_credit = struct 4module Debit_credit = struct
6 type t = Debit | Credit [@@deriving string, sexp_of] 5 type t = Debit | Credit [@@deriving string, sexp_of]
@@ -561,21 +560,6 @@ let tx_from_prim ptx ~ams_tz : (tx, parse_err_ext) result =
561 560
562type csv_err = Parse_err of parse_err_ext | Exn of exn 561type csv_err = Parse_err of parse_err_ext | Exn of exn
563 562
564module List = struct
565 include List
566
567 let map_result ~(f : 'a -> ('b, 'c) result) : 'a list -> ('b list, 'c) result
568 =
569 let open Result.Let_syntax in
570 let rec go = function
571 | [] -> return []
572 | x :: xs ->
573 let%map x' = f x and xs' = go xs in
574 x' :: xs'
575 in
576 go
577end
578
579let read_channel (c : In_channel.t) ~ams_tz : (tx list, csv_err) result = 563let read_channel (c : In_channel.t) ~ams_tz : (tx list, csv_err) result =
580 let%bind ptxs = 564 let%bind ptxs =
581 try 565 try