Consider changing `id` to `identity`
This is bikeshedding so feel free to close it, but Protolude uses identity instead of id and I think it's a classy decision. The desire to use id as a variable name is pretty common. Also I feel like avoiding abbreviations in core function names is nice when possible (identity is still pretty short).
I like the idea; not sure about my muscle memory though. anyone else like/dislike ?
id shows up a lot in laws, but partly because of this I find it's actually pretty rare to use id in code - generally it can be removed by following one of those laws. In contrast, things having "id's" show up all the time. As a result, I think I'm slightly positive towards this proposal.
The best bikeshed discussions are caused by non-contributors joining in, so here goes.
Is identity optimal? There are other identity elements such as the additive identity of 0, multiplicative 1, and identity functors. Is idfun less ambiguous (though harder to guess)?
(I like the idea of freeing up the name id.)
Having a function identity would also be consistent with having a Monad Identity (like the one in Data.Functor.Identity). id can then be more easily used to denote identifiers (or anything else).
Is
idfunless ambiguous (though harder to guess)?
I personally don't like specifying the type of a thing in its name.
I think prioritising the function meaning for identity over the math (additive identity, ..) is suited to haskell being a _function_al language.
All the other identities are identity with respect to some semantics, whereas the function identity really is identity for everything.
How about noop? ;)
@crabmusket: not that I think it doesn't have some charm, pushing toward cpu concept is a bit far fetch :)
Let's rename it to identity, I think everyone is in rough agreement (speak now otherwise)
One thing, is that Control.Category.id is re-exported as id. We obviously can't change the name of the class without forking the class and creating some further compatibility issue. The alternative is to re-export with:
identity :: ...
identity = Control.Category.id
Why not export identity :: a -> a, and leave id from Category not in scope by default, and now not clashing.