Skip to content

Unit Type

In type theory, the unit type can always be constructed. It has a single value, unit.

It is related to the singleton set from set theory and dual to the void type

In Haskell, unit is represented with the empty list ().

It's possible to construct the function f :: a -> () easily, as unit can always be constructed.

Similarly, f :: () -> Int or to any other concrete type in a pure language acts as a constant for a specific value. When corresponding this idea into category theory it's possible to use this to define all objects within the category - this is the initial object. Not every category has an initial object.