logoalt Hacker News

mrkeenlast Monday at 12:47 PM1 replyview on HN

string reversal, integer negation or toUpperCase are classical examples of functions which will not compile as `a -> a`

The function which will compile as `a -> a` is the identity function.


Replies

epolanskilast Monday at 1:04 PM

That's correct, but I'm not sure how it relates to my comment as I said that `a -> a` is just an endomorphism.

identity, uppercase or negate are all endomorphisms, with identity being the only generic one.