How to change function calls with parenthesis using composition in Haskell? -
here's write:  (take 2 (repeat " "))
i want change expr without parenthesis.
can use "." so:
ceiling (negate (tan (cos (max 50 x)))) can changed  ceiling . negate . tan . cos . max 50
but tried (take 2) . (repeat " ")
and (take . (repeat " ")) 2 both don't work?
anybody help?
what want is
 take 2 . repeat $ " "   . composes functions. here compose take 2 , repeat. convert bigger:
a b c (d e f (g h i)) b c . d e f. g h $   you compose functions , partial application of inner function (here g h i) , it's last argument. creates big function last argument end result.
then apply function $ precedence correct. discovered, since $ application different precedence, can group parens. prefer $.
Comments
Post a Comment