Hacker News new | ask | show | jobs
by CapacitorSet 3199 days ago
I can't quite understand the difference between endomorphism ("input and output of the transformer must be from the same category") and homomorphism ("structure preserving transformation. We always stay in the same category"). Can someone help?
3 comments

Homomorphisms are structure-preserving mappings between different types (called “category” in the post, in usual terminology, these would be »objects« in a »category«, though). Endomorphisms are special homomorphisms, mapping from a single type (»object«) to the same type (»object«).

It is indeed very unfortunate that the article conflates terminology.

I believe homomorphism is a subset of endomorphism.

So a function that turns an array into another array of different length would be endomorphic (since it maintains the same type), but not homomorphic since it has a different structure (a different set of keys).

The other way around. A homomorphism is a structure-preserving map between two arbitrary objects, whereas an endomorphism is a homomorphism where the source and target objects coincide.
Endomorphism has less implied structure. Lots of dumb things are endomorphisms. Homomorphism implies "structure preservation" which can make it more specific.
I'm surprised to read this coming from you.
It seems "endomorphism" is used both ways (in, presumably, different contexts).

https://ncatlab.org/nlab/show/endomorphism

I think "endomorphism is a homomorphism ..." is more common, but notably is not the usage in Haskell (https://hackage.haskell.org/package/base/docs/Data-Monoid.ht...)

Of course, Haskell's `Endo` is a type constructor for `Hask`-endomorphisms, but more interesting categories exist. Tell me with a straight face ring and field endomorphisms aren't interesting.