4 ms·
Yes, <$> is the general `map` (`fmap`) <*> takes function(s) out of a mappable and applies it (them) to argument(s) within a mappable. (+) <$> [1,2,3] =
by spion 11y ago
Yes, <$> is the general `map` (`fmap`)
<*>
takes function(s) out of a mappable and applies it (them) to argument(s) within a mappable.
(+) <$> [1,2,3] = [add 1, add 2, add 3]
(+) <$> [1,2,3] <*> [10, 20] = [(1 +), (2 +), (3 +)] <*> [10, 20] = [11, 21, 12, 22, 13, 23]
(+) <$> Just 3 <*> Just 5 = Just (3 + ) <*> Just 5 = Just 8
(+) <$> readLn <*> readLn = ...
well that depends on the inputs :)