Both these function combinators and more concise operators for sources would be encompassed by user-defined infix operators. I expect this would be more work than the proposed patch, but if the demand for infix operators is high enough, I think this would be better than an ever-expanding unconfigurable hodgepodge of built-in operators.
On Thu, Feb 19, 2015 at 9:46 PM, Timothy Beyer <[email protected]> wrote: > At Thu, 19 Feb 2015 18:34:49 +0000 (UTC), > Gabriel Riba wrote: > > > > Adam Chlipala <adamc <at> csail.mit.edu> writes: > > > > > > > > OK, I see. By "functional," you meant "related to function > application, > > > composition, etc.", not a general mechanism for introducing new infix > > > operators. > > > > > > If you (or anyone else) want to experiment with tweaking src/urweb.grm > > > to add some new operators, I'll be happy to accept a patch embodying > > > tasteful choices. :) (May also require adding to lib/ur/top.ur[s] new > > > definitions of conventionally named functions, to which the new > > > operators desugar.) > > > > > > > Hello! > > > > I've worked out a solution for the function application and composition > > operators, after revising the mlton manuals for ml-lex and ml-yacc, and > it > > works. > > > > I need your opinion to ensure if it is complete. > > > > The operators in this trial are > > > > (<|) : forward application (right associative), named FWDAPP in .lex and > .grm > > (|>) : reverse application (left associative), named REVAPP > > (<<<) : right-to-left composition (right associative) (equivalent to ML's > > (o)), named COMPOSE > > (>>>) : left-to-right composition (right associative), named ANDTHEN > > I can't speak for Adam, but I've wanted infix apply and compose operators > in Ur/Web for a while, so I'm looking forward to trying this patch. > > If Ur/Web ever gains pattern matching on a function level (eg. without > requiring an extra case statement), plus pattern matching extensions such > as OR patterns, and more concise operators for sources, then it would be > absolute bliss for me, even though what I suggest is quite a lot of > syntactic sugar. > > Regards, > Tim > > _______________________________________________ > Ur mailing list > [email protected] > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur >
_______________________________________________ Ur mailing list [email protected] http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
