3 ms·
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 Te
by jolmg 7y ago
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_guide/template-haskell.html https://downloads.haskell.org/~ghc/7.8.4/docs/html/users_gui...
[2] https://github.com/yesodweb/yesod/blob/c8aeb61ace568cdc2bc81d54f75c1a7d40ad3324/yesod-core/helloworld.hs#L40 https://github.com/yesodweb/yesod/blob/c8aeb61ace568cdc2bc81...
- tome 7y agoYes, but I suspect euske, being unfamiliar with Haskell, just used an unfamiliar form.