Re: Monad Comprehension Sugar

"Daniel C. Wang" <[email protected]>
Newsgroups gmane.comp.lang.sml.smlnj
Message-ID <[email protected]>
I suspect a more useful approach, would be to extend the frontend in a 
more generic (caml4p) style way
Ideally, you  could register and extension with the frontend.

val registerSyntax :  (string * string -> Ast.exp) -> unit

registerSyntax ("monad",parse)


val test = #monad [(x, y) | x <~ [1,2],   y <~ ["a","b"] ]

Geoffrey Alan Washburn wrote:
>
>     Somewhat related to my other e-mail, I've just finished putting 
> together a patch to SML/NJ to allow monad comprehensions.  Here is an 
> example of using it to implement the list monad.
>

I think such an extension would not be too hard to do in fact, and 
generally useful. More importantly, one could even modify the pretty 
printer in a way that you eliminate syntactic extensions in order to be 
backward compatible with other compilers.



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.