module IntMap = Map.Make(struct type t = int let compare = compare end)let rec count_with_map (il: int list) = match il with | [] -> [] | head :: tail -> match count_with_map tail with | (c, n) :: tail when head = n -> (head, n + 1) :: tail | tail -> (head, 1) :: tail ;;
I think this is right but I kept getting this error.
Error: This expression has type (int * int) list but an expression was expected of type 'a Count_with_map.IntMap.t