5 ms·
recordval.fieldname would have the same syntax as function composition func1.func2 Since you should know the type of the first argument to '.', it is possible
by joelwilliamson 12y ago
recordval.fieldname would have the same syntax as function composition func1.func2
Since you should know the type of the first argument to '.', it is possible to disambiguate, but it would be a pretty significant corner case in the grammar.
- wcbeard10 12y agoThat was my intuition as well, but doesn't seem to explain why we can still use the syntax with modules (i.e., Set.map), unless the capitalized module name makes all the difference.
- jozefg 12y agoIt does, it's ambiguous to have `Constructor.fun` for this reason.
- deleted 12y ago[deleted]
- yummyfajitas 12y agoOne could simply choose an alternate symbol, e.g. record~>fieldname (which is similar to C++). I admit choosing a symbol in Haskell is a bit harder, since most of the easy ones are already taken.
- chongli 12y agoYes and Haskell allows arbitrary user-defined operators. Once the genie is out of that bottle it's hard to put it back inside!