In Maybe applicative, <*>
can be implemented based on fmap
. Is it incidental, or can it be generalized to other applicative(s)?
(<*>) :: Maybe (a -> b) -> Maybe a -> Maybe b
Nothing <*> _ = Nothing
(Just g) <*> mx = fmap g mx
Thanks.
See also In applicative, how can `<*>` be represented in terms of `fmap_i, i=0,1,2,...`?