Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



One 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.


Yes and Haskell allows arbitrary user-defined operators. Once the genie is out of that bottle it's hard to put it back inside!


That 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.


It does, it's ambiguous to have `Constructor.fun` for this reason.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: