Two simple declarations:

let x = 3 let f x = x + 1

and, after compilation with ocamlc -i example.ml, their types:

val x : int val f : int -> int

Then, building on these definitions:

let y = f 3
val y : int

What about compiler error messages?:

let z = 3 + "four"

They are also detected:

File "example.ml", line 1, characters 12-18: Error: This expression has type string but an expression was expected of type int

We can continue on from earlier examples:

let z = f y
val z : int

This document was translated from LATEX by HEVEA.

mirror server hosted at Truenetwork, Russian Federation.