typelead / etlas

Etlas, the build tool and package manager for the Eta programming language
63 stars 10 forks source link

Config.hs: Corrects git repo name #33

Closed ouromoros closed 6 years ago

ouromoros commented 6 years ago

Closes https://github.com/typelead/eta/issues/634

CLAassistant commented 6 years ago

CLA assistant check
All committers have signed the CLA.

ouromoros commented 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?

ouromoros commented 6 years ago

@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?

rahulmutt commented 6 years ago

@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))