Syntax for a module option

I am trying to create a type with an additional map:

module CharMap = Map.Make(Char)
type trie = bool * CharMap.t option


But this results in a syntax error:

Error: The type constructor CharMap.t expects 1 argument(s),
       but is here applied to 0 argument(s)


What am I doing wrong?


source to share

1 answer


is a mapping from char

to 'a

, so it's actually a type 'a Charmap.t

, so you forget to specify a polymorphic argument. Therefore, you must write:

type 'a trie = bool * 'a CharMap.t option


If you want your map to be monomorphic (for example char -> int

), you can simply write:

type trie = bool * int CharMap.t option




All Articles