I want to write a function that accepts values of a custom class myType
, and returns myType option
. Not sure if my problem is with signature, content or return values.
For example, I've tried to write the following (it's simplified and have no real meaning):
let rec myFunc (t:myType) myType option =
let t2 = myFunc t in
match t2 with
| None -> None
| _ -> t
And I'm getting the following compilation error:
Error: This pattern matches values of type 'a option but a pattern was expected which matches values of type 'b -> 'c -> 'd
Not sure what's wrong with my syntax or where I'm misunderstanding OCaml.
I only see a missing colon and
Some
:Slightly streamlined version: