3 ms·
It's worth pointing out that Haskell has always overloaded the dot. It is used for module namespace disambiguation, e.g Set.fromList
by willtim 6y ago
It's worth pointing out that Haskell has always overloaded the dot. It is used for module namespace disambiguation, e.g Set.fromList
- srtjstjsj 6y agoBut you've got the module there to disambiguate the ., which you don't have in records.
- runeks 6y agoI don't think this is true. The presence of a qualified import of "Data.Set as Set" does not change how the following is parsed. import Data.Set (fromList) import qualified Data.Set as Set data Set a = Set (Set.Set a) f :: Ord a => [a] -> Set a f = Set . fromList g :: Ord a => [a] -> Set a g = Set .fromList h :: Ord a => [a] -> Set a h = Set. fromList i :: Ord a => [a] -> Set.Set a i = Set.fromList In other words, the . is interpreted as a "module dot" if and only if there is no whitespace either preceding or following the dot.
- runeks 6y agoGreat point! I hadn't thought of this. It looks like the "record dot" follows the same parsing rules as the "module dot": the presence of whitespace turns the . into function composition.