I'm learning Monad in OCaml, but it doesn't compile.
I reduced the code to reproduce the problem at easiest way :
file try.ml:
module type TRY = sig type 'a t val return : 'a -> 'a tendmodule Try : TRY = struct type 'a t = Success of 'a | Failure of exn let return a = Success aendlet () = match Try.return 5 with | Try.Success a -> print_int a | Try.Failure e -> print_endline (Printexc.to_string e)
then I compile with :
ocamlc try.ml
and i get this error :
Error: Unbound constructor Try.Success
I found nowhere a clue to repair, I need help.