Skip to content

Commit 4431b99

Browse files
committed
style: migrate pipes to A combinators
1 parent 6afccec commit 4431b99

File tree

5 files changed

+18
-19
lines changed

5 files changed

+18
-19
lines changed

lib/archive.ml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ let generate_text file_name =
6363
let human_sizes =
6464
List.mapi
6565
(fun i size ->
66-
if List.nth !strmodes i |> String.starts_with ~prefix:"d" then "-"
66+
if String.starts_with ~prefix:"d" @@ List.nth !strmodes i then "-"
6767
else humanise_size @@ Int64.to_int size)
6868
!sizes
6969
in
@@ -90,16 +90,16 @@ let generate_text file_name =
9090

9191
(* TODO: terminal colours *)
9292
let res =
93-
List.init (List.length !strmodes) (fun i ->
94-
let raw_size = List.nth human_sizes i in
95-
let size = List.nth colorised_sizes i in
96-
let strmode = List.nth !strmodes i in
97-
let mtime = List.nth colorised_dates i in
98-
let name = List.nth !names i in
99-
strmode ^ " "
100-
^ repeat " " (max_size - String.length raw_size)
101-
^ size ^ " " ^ mtime ^ " " ^ name)
102-
|> String.concat "\n"
93+
String.concat "\n"
94+
@@ List.init (List.length !strmodes) (fun i ->
95+
let raw_size = List.nth human_sizes i in
96+
let size = List.nth colorised_sizes i in
97+
let strmode = List.nth !strmodes i in
98+
let mtime = List.nth colorised_dates i in
99+
let name = List.nth !names i in
100+
strmode ^ " "
101+
^ repeat " " (max_size - String.length raw_size)
102+
^ size ^ " " ^ mtime ^ " " ^ name)
103103
in
104104

105105
archive_read_free archive >>= fun () -> res

lib/directory.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
let directory () =
22
let stream =
33
Unix.open_process_in
4-
"eza -a1F --color=always --group-directories-first --icons=always --git"
4+
@@ "eza -a1F --color=always --group-directories-first --icons=always --git"
55
in
6-
stream |> In_channel.input_all |> print_endline;
6+
print_endline @@ In_channel.input_all stream;
77
In_channel.close stream

lib/ffmpeg.ml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
let generate_thumb file_name cache_file =
2-
(* create quicklook thumbnail *)
3-
Printf.sprintf "ffmpeg -ss 00:00:01 -i \"%s\" -frames:v 1 \"%s\"" file_name
4-
cache_file
5-
|> Unix.open_process_in |> ignore
2+
ignore @@ Unix.open_process_in
3+
@@ Printf.sprintf "ffmpeg -ss 00:00:01 -i \"%s\" -frames:v 1 \"%s\"" file_name
4+
cache_file
65

76
let thumbnail ~width ~height file =
87
let cache_file = Helpers.get_cache_file file `THUMB in

lib/ffmpeg.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
val thumbnail : width:int -> height:int -> string -> unit
2-
(** Generate thumbnails with quicklook *)
2+
(** Generate thumbnails with ffmpeg*)

lib/helpers.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ let cache_dir =
2323
dirpath
2424

2525
let get_cache_file file_name cache_type =
26-
let hash = Digest.MD5.file file_name |> Digest.to_hex in
26+
let hash = Digest.to_hex @@ Digest.MD5.file file_name in
2727

2828
cache_dir ^ hash ^ match cache_type with `TEXT -> ".txt" | `THUMB -> ".png"

0 commit comments

Comments
 (0)