[Haskell-cafe] Usage of . and $
Nicolas Frisby
nicolas.frisby at gmail.com
Wed Mar 7 17:11:22 EST 2007
> I don't use rank-2 types that often and when I do I'm aware of the
> restriction on ($) and similar hofs. I tend to use ($) only when the
> right-hand side gets very messy; a multiple-line do or similar. For
> example:
>
> blah = fromMaybe $ do
> x <- blah1
> y <- blah2
> guard (x == f y)
> g x
>
> The closing parenthesis would make things a little messy, so ($) is nice.
>
> -David House, dmhouse at gmail.com
For this situation, I go ahead and name the subcomputation with a
where clause or a do-let binding. Usually, naming sub terms can't
hurt.
Other than "look at Darcs or GHC", has there been any efforts for
(very general, libertarian even) coding guidelines? "Suggestions &
tips" might be a better word.
More information about the Haskell-Cafe
mailing list