((<*>) . (<*>))
--In GHCi
:: (a1 -> a2 -> b) -> ((a1 -> a2) -> a1) -> (a1 -> a2) -> b
Why is it in such type? how can it evolve to such type?
:t ((<*>) .)
((<*>) .)
:: Applicative f => (a1 -> f (a2 -> b)) -> a1 -> f a2 -> f b
:t (. (<*>))
(. (<*>))
:: Applicative f => ((f a -> f b) -> c) -> f (a -> b) -> c
((<*>) . (<*>))
--from left to right
(<*>) :: Applicative f1 => f1 (a1 -> b1) -> f1 a1 -> f1 b1;(.) :: (b -> c) -> (a -> b) -> a -> c;(<*>) :: Applicative f2 => f2 (a2 -> b2) -> f2 a2 -> f2 b2;
In 2., (a -> b), let 3. f2 (a2 -> b2) = a; therefore, b should be f2 a2 -> f2 b2, (b -> c), replaced by 1., b is f1 (a1 -> b1), c should be f1 a1 -> f1 b1
However, b should be equal to each other, f2 a2 -> f2 b2 = f1 (a1 -> b1) ? how to fit both to each other
In GHCi, it seems it replaces f (a -> b) with a1 or a2, then how it goes forward?
(->) ais anApplicative. - AJF