Home:ALL Converter>Is ((f a) b) the same as (f a b) in Haskell?

Is ((f a) b) the same as (f a b) in Haskell?

Ask Time:2018-08-09T06:32:30         Author:user8314628

Json Formatter

map2_Maybe :: (a -> b -> c) -> Maybe a -> Maybe b -> Maybe c
map2_Maybe f Nothing _ = Nothing
map2_Maybe f (Just a) Nothing = Nothing
map2_Maybe f (Just a) (Just b) = Just ((f a) b)
-- Or: map2_Maybe f (Just a) mb = fmap (f a) mb

map2_Either :: (a -> b -> c) -> Either e a -> Either e b -> Either e c
map2_Either f (Left e) _ = Left e
map2_Either f (Right a) (Left e) = Left e
map2_Either f (Right a) (Right b) = Right (f a b)
-- Or: map2_Either f (Right a) eb = fmap (f a) eb

In these two examples, Is ((f a) b) the same as (f a b) since every function in Haskell can only take one argument?

Author:user8314628,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/51756566/is-f-a-b-the-same-as-f-a-b-in-haskell
Daniel Wagner :

Yes, they are exactly the same.",
2018-08-09T00:47:53
yy