I am moving from Haskell to OCaml, but I am having problems. For example, I need a type definition for regular expressions. I am doing this with:
type re = EmptySet | EmptyWord | Symb of char | Star of re | Conc of re list | Or of (RegExpSet.t * bool) ;;
The elements inside Or are in the set (RegExpSet), so I define it as follows (as well as the display function):
module RegExpOrder : Set.OrderedType = struct let compare = Pervasives.compare type t = re end module RegExpSet = Set.Make( RegExpOrder ) module RegExpMap = Map.Make( RegExpOrder )
However, when I do "ocaml [file name]", I get:
Error: Unbound module RegExpSet
in the string "Or" in the definition of "re".
If I change these definitions, that is, if I write module definitions before definitions of type re, I obviously get:
Error: Unbound type constructor re
in the line "type t = re".
How can i solve this? Thanks!
vegetus
source share