4 ms·
Interesting, although I am not sure how Unit and Bottom are related to monoids. Also, how does this translate, say, into C or C++? Unit is easy: struct Unit
by Koshkin 9y ago
Interesting, although I am not sure how Unit and Bottom are related to monoids. Also, how does this translate, say, into C or C++? Unit is easy:
struct Unit {};
but what about Bottom?
- kbaldor 9y agoHow about: class Bottom { private: Bottom(){} };
- Koshkin 9y agoThis does not look right. If I understand correctly, the position of Bottom in the hierarchy of types is exactly the opposite to that of Unit: the latter could serve as the "universal base" (like the type Object), whereas the former could be seen as the "universal descendant" (some kind of Null type). In other words, Unit is "anything" and Bottom is "nothing".
- theoh 9y agoSee https://en.wikipedia.org/wiki/Top_type https://en.wikipedia.org/wiki/Top_type
- theoh 9y agoEven Haskell doesn't have a way to declare a value precisely of type Bottom. As far as the connection with monoids goes, Bottom is a subtype of all types in the same way that the empty element of a monoid is a "zero" of the elements of the monoid. I don't know if that helps, but the similarity is that the types form a lattice, and so do the elements of the monoid. AIUI lattices (in the mathematical sense) have top and bottom elements, and in between they look like a DAG...