I'm trying to make a type with an optional 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?
CharMap.t is a map from char to 'a, so actually its type is 'a Charmap.t, so you forget to specify the polymorphic argument. So you should write:
type 'a trie = bool * 'a CharMap.t option
If you want your map to be monomorphic (for instance char -> int) you can just write:
type trie = bool * int CharMap.t option
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With