open Core;;
List.exists ["a"; "b"; "c"] ~f:(fun x -> x = "a");;
Error: This expression has type string but an expression was expected of type int
List.exists [1; 2; 3] ~f:(fun x -> x = 3) works fine.
List.existsi also gives me the same error on string list.
Even the following code gives me the same error message if i open Base or Core in Utop.
open Core;;
let exists t ~f =
let rec loop t =
match t with
| [] -> false
| hd :: tl -> f hd || loop tl
in
loop t ;;
exists ["a"; "b"; "c"] ~f:(fun x -> x = "a") ;;
Test Environment 1:
OS: macOS Catalina version 10.15.7
OCaml: 4.14.0
Utop: 2.9.2
I am not sure if i miss something or it's a bug.
List.exists [1; 2; 3] ~f:(fun x -> x = 3)
works fine.List.existsi
also gives me the same error on string list.Even the following code gives me the same error message if i open Base or Core in Utop.
Test Environment 1: OS: macOS Catalina version 10.15.7 OCaml: 4.14.0 Utop: 2.9.2
Test Environment 2 (newly installed machine): OS: Utuntu 22.04 OCaml: 4.14.0 Utop: 2.92