Uses of the type Unit
-
03-11-2019 - |
Question
The Unit
type is a singleton type containing the constant unit
. In functional languages with side effects, unit
is used in functions that perform side effects. For example print
is a function from string
to Unit
.
Unit
also corresponds to truth. If you view the type of the expression as a proposition and the program as a proof, Unit
corresponds to truth since you can always prove Unit
by using the constant unit
.
My question is aside from these two uses, is there any other uses of Unit
?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with cs.stackexchange