I am very new to OCaml and am trying to convert a StringMap to a List in OCaml.
The map was generated from a list previously.
let map = List.fold_left(<SOME CODE HERE, WHICH I AM OMITTING>
) StringMap.empty
in StringMap.fold(fun w c newlist -> (c,w)::newlist) map[]
The last line in the code above gives me the following error: This expression has type StringMap.key list -> int StringMap.t but an expression was expected of type 'a StringMap.t = 'a Map.Make(String).t
Please note: This code is typed into an ocamllex file (.mll) and I get this error when I try to execute the lexical analyser (.ml) file generated.
Why am I getting this error? How do I get my code to work?
Thanks!