4 ms·
It's not that. The thing you're describing is often called a "functor". It could be called a "mappable" but generally once you've heard a functor is a thing tha
by tel 4y ago
It's not that. The thing you're describing is often called a "functor". It could be called a "mappable" but generally once you've heard a functor is a thing that has a .map() function that works the way you expect it to then you don't really need to call it a mappable anymore. So the name sticks.
Even to just be able to rapidly identify why having a thing that .map()s is a meaningful object represents the sort of experience with and abstraction of these concepts that'll put you ahead of the game for understanding monads.
- IshKebab 4y agoOh yeah I mixed them up. I still think `Mappable` is a much better name than `Functor`, and names matter. Especially for difficult to understand concepts. Functor isn't really even the right type of word. It should be Functable or something. Monad should be `FlatMappable`. I found this great article where they use exactly these terms to explain it: https://dev.to/joelnet/functional-javascript---functors-monads-and-promises-1pol https://dev.to/joelnet/functional-javascript---functors-mona... If people are using different terms to explain your confusing terminology then... maybe the confusing terminology is not very good.
- nybble41 4y ago"Functor" is a perfectly good and descriptive name… provided you are at least somewhat familiar with the esoteric branch of mathematics it's based on. For someone from a Category Theory background renaming it to "Mappable" would be weird and unintuitive. And as in most things, those actually doing the work get to pick the names that make sense to them.
- codebje 4y agoIf you're not even slightly familiar with that branch of mathematics it's still a perfectly good and descriptive name, because you can search for the term and get loads of relevant information from the programming side of things. (The mathematical basis helping you get deeper insights into it is just a bonus, albeit IMO a valuable one.)
- codebje 4y agoNames certainly do matter: they're how we effectively communicate with each other. If you call it a mappable, and someone else calls it a chainable (as was said elsewhere in this comment thread), how have we eased confusion? If I try to google what a chainable is, what will I find? On the other hand, if I say "it's a monad" then people who have encountered the term before know what I mean (even if they've had no need to understand monads in depth) and people who have not will successfully find information about the right thing if they search for it. Monads have a particularly bad reputation for being hard to learn, despite appearing in non-general form in every modern language. Since people seem to have little trouble grasping the way in which futures, streams, and options work I don't think there's really such a great challenge involved - but the culture of running screaming from the mere word doesn't help matters in the least.
- tel 4y agoI'm not saying functor is a good name. I'm saying it's the name that's more or less stuck. To start using a new one is just to make the terminology even more confusing. For what it's worth, "functor" properly describes the combination of a type and its relevant .map() function. It's (common) shorthand to refer to just the type as "a functor" when there's a unique, well-known functor that utilizes that type. So, we could be more precise, of course. But also if you just throw up your hands when someone says "a list is a functor" then you're fighting a difficult battle.