[Haskell-cafe] Basic question concerning the category Hask (was: concerning data constructors)

Miguel Mitrofanov miguelimo38 at yandex.ru
Sun Jan 6 12:02:17 EST 2008

>> Take the ordinary disjoint union, and then add a new _|_ element,
>> distinct from both existing copies of _|_ (which are still distinct
>> from each other).
> Now why is that not the category-theoretic coproduct?
> h . Left = f and h . Right = g both for _|_ and for finite
> elements of the types. And it looks universal to me.

Yeah, but there could be more functions from Either X Y to Z than  
pairs of functions from X to Z and from Y to Z.

For example, if z :: Z, then you have two functions h1 and h2 such  
that h1 . Left = const z and h1 . Right = const z and the same holds  
for h2. Namely,

h1 = const z

h2 = either (const z) (const z)

This functions are different : h1 (_|_) = z while h2 (_|_) = (_|_).  
And if Either X Y was a category-theoretic coproduct, then the  
function from Either X Y to Z would be UNIQUELY determined by it's  
restrictions to X and Y.

More information about the Haskell-Cafe mailing list