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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -