In a recent course based on Scala I found a hint that the Scala types Try[T]
and Future[T]
are dual. This was explained only informally and the reader was referred to duality in category theory for a more precise definition.
I have some basic knowledge of category theory but I cannot see how these two types can correspond to categories that are dual to each other.
So, what categories correspond to the Scala types Try[T]
and Future[T]
, and why are these categories dual?