The canonical type with one element. This element is written ().
Unit has a number of uses:
-
It can be used to model control flow that returns from a function call without providing other information.
-
Monadic actions that return
Unithave side effects without computing values. -
In polymorphic types, it can be used to indicate that no data is to be stored in a particular field.