10 ms·
> The method names are more intuitive: e.g., then instead of map But map makes total sense, considering that maybe is a monad.
by blastonico 2y ago
> The method names are more intuitive: e.g., then instead of map
But map makes total sense, considering that maybe is a monad.
- voidhorse 2y agoTrue, but I would not be surprised if the vast majority of Java programmers have no clue what a monad is.
- deleted 2y ago[deleted]
- chii 2y ago> no clue what a monad is. which is a good opportunity to introduce said nomenclature, and ideas to them, rather than renaming said method to something more "palatable".
- Dansvidania 2y agoIn my experience just name-dropping monads in non functional-programming oriented circles will get weird looks. EDIT: I would even argue, as a fan of FP, that it's not immediately obvious how this terminology or concept even helps, from the point of view of a non purely functional programming language
- mrkeen 2y agoBecause the alternative to using one name is using more than one name. These days I'm pretty sure I'm using `select` to mean `map`.
- xigoi 2y agoYou don’t need to mention monads, just imagine an Optional as a list with at most one element.
- edflsafoiewq 2y agoRather than monads, map is more likely to be familiar from sequences, and an optional is just a sequence with length < 2.
- eru 2y agoWell, monads get their map from functors, and they call it 'map' (or fmap) because of map on sequences.
- coin 2y ago“then” is definitely less intuitive
- puchatek 2y agoIntuition is in the eye of the beholder
- eru 2y agoWell, it only needs to be a functor (in the Haskell sense) for map to make sense. (Of course, all monads are also functors.)
- Jaxan 2y agoI would expect different types of map and then: map :: (a -> b) -> Maybe a -> Maybe b then :: (a -> Maybe b) -> Maybe a -> Maybe b Although for Maybe these are not too different.