Closed ouromoros closed 6 years ago
@rahulmutt Plz review. I think I have managed it, but I'm not quite sure if I'm doing it the right way. btw, is there anyway to write test for it? Or should I just rebuild manually after a change?
@rahulmutt Thanks a lot! I made the corresponding change now. I tried to use a $ and then . operator between the uriPath and remoteRepoURI function to avoid parenthesis, but curiously neither compiled successfully. I'm still very new on Haskell, so could you tell me where I got wrong?
@ouromoros The $
and .
don't work properly in the presence of infix operators (in this case (++
)), so you need to specify parentheses.
What you could've done:
"git@github.com" ++ (uriPath . remoteRepoURI $ repo)
OR
"git@github.com" ++ (uriPath $ remoteRepoURI repo)
IMHO, neither of these is any clearer than just using simple parentheses like you've done in your PR. In small expressions like this, I prefer not to use $
and .
since they make it look unnecessarily complicated. $
and .
are great for large pipelines of functions or when the number of parenthesis become unwieldly (say 3 layers of parens)..
A quick way to remember how it works:
(a . b. c . d) $ e = (a . b . c) $ d e = (a . b) $ c (d e) = a (b (c (d e))
Closes https://github.com/typelead/eta/issues/634