I searched for the source of GHC.Unicode and realized that almost all Haskell internal libraries avoid tacit programming (aka dot style) most of the time. Simple functions can be easily transformed, for example:
isLatin1 :: Char -> Bool isLatin1 c = c <= '\xff'
Result:
isLatin1 :: Char -> Bool isLatin1 = (<= '\xff')
But there are times when I cannot use it, for example, when I have more complex functions, for example:
isOctDigit c = c >= '0' && c <= '7'
It is difficult to subtract the way operations are compiled. I donβt want to fall into the range, I mean several operations, just creating functions. Following:
isOctDigit = (>= '0') && (<= '7')
Invalid as well (>= '0') . (<= '7') (>= '0') . (<= '7') clearly cannot happen due to different return types.
Given these observations, I have the following questions:
- When to use explicit programming instead of explicit everything?
- Why does the GHC prefer to use explicit instead of using partial functions?
- How can I compose two functions of different types without an explicit expression, for example, in the example?
source share