Example in Unix module:
val environment : unit -> string array
Why not just:
val environment : string array
?
Because it denotes a function that takes a value of type unit as its parameter. The unit type is only inhabited by the value "()". This is usually used to mean that the function is going to perform some kind of IO or induce a side-effect, and needs no input. The second type signature you provided is the signature for a value, not a function that can be applied. If some expression were bound to this name, that expression would be evaluated at the time the value binding takes place, not at the time it is referenced (as is the case with function application).
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