3 ms·
Very much so, it’s a functor instance on some sort of tree, except the `map` includes a conditional dispatch. It’s essentially fmap $ ap fromMaybe Except
by masklinn 3y ago
Very much so, it’s a functor instance on some sort of tree, except the `map` includes a conditional dispatch.
It’s essentially
fmap $ ap fromMaybe
Except this doesn’t quite work, I’m sure there’s a pointfree version, best I can achieve is
\p -> fmap $ ap fromMaybe p
Which takes an `a -> Maybe a` and an `[a]`, and replaces all the values for which the callback returns `Some`, and leaves as-is all the values for which it returns `None`.
(I collapsed the `whereFn` and `updateFn` into a single one because there’s no reason not to)
- gdprrrr 3y agoYou're looking for `fmap . ap fromMaybe`