[Haskell-cafe] Why does `flip` cause function type so different ?

zaxis z_axis at 163.com
Sat Mar 20 22:37:36 EDT 2010


As a beginner, i cannot understand completely what both Maciej Piechotka and
Daniel Fischer-4 said. However, i think it will be a big step for me to
study haskell once  i understand it.

thanks !


zaxis wrote:
> 
>>let f x xs = [x:xs,xs]
>> :t  f
> f :: a -> [a] -> [[a]]
> 
>>:t  (>>=) .f
> (>>=) .f :: a -> ([[a]] -> [a] -> b) -> [a] -> b
> 
>> :t (flip (>>=) .f)
> (flip (>>=) .f) :: a -> [[a]] -> [[a]]
> 
> Why is the type of `(>>=) .f` and `flip (>>=) .f` so different ?
> 
> BTW, Would you mind explaining the following result ?
>>let fff x y z = x + y +z
>>((>>=) . fff) 2 (\f x -> f x) 3
> 8
> 
> Sincerely!
> 


-----
fac n = let {  f = foldr (*) 1 [1..n] } in f 
-- 
View this message in context: http://old.nabble.com/Why-does-%60flip%60-cause-function-type-so-different---tp27950886p27973366.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list