Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

At least, I've never seen someone use the `$` operator and put the right operand without any spacing in between. Not only would it cause errors on activating Template Haskell because GHC would interpret it as a TH splice[1], but also it would be weird to read because one tends to use the `$` operator when they have a multi-term expression they would otherwise not want to parenthesize. For example, take a look at this line in Yesod[2]:

  $logInfo $ pack $ show (a, b, c)
The one without a space is a Template Haskell splice and the ones with a space are using the function application operator. If logInfo didn't need to be expanded by Template Haskell and we deactivate that extension, we could write:

  logInfo $pack $show (a, b, c)
But I doubt anyone would because the implied parentheses around those operators are:

  (logInfo) $((pack) $((show) (a, b, c)))
[1] https://downloads.haskell.org/~ghc/7.8.4/docs/html/users_gui...

[2] https://github.com/yesodweb/yesod/blob/c8aeb61ace568cdc2bc81...



Yes, but I suspect euske, being unfamiliar with Haskell, just used an unfamiliar form.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: