emilaxelsson / syntactic

Generic representation and manipulation of abstract syntax
BSD 3-Clause "New" or "Revised" License
25 stars 13 forks source link

Examples using pattern synonyms? #16

Open Blaisorblade opened 10 years ago

Blaisorblade commented 10 years ago

It seems that pattern synonyms are perfect for scenarios like using the syntactic library, so, in case you don't know them already, you might want to take a look at Blaisorblade/learning-syntactic@a209c3c59644695ca956440b7de916570d94ffdf is an (improvable) example.

This is mainly a comment; the only actual "issue" is that examples should probably suggest this usage. GitHub search on this code didn't find any example though.

Reading your ICFP 2012 paper and searching "Combining Deep and Shallow Embedding for EDSL" found no hint about that (probably because pattern synonyms are newer than these papers). Your ICFP2012 paper (in Sec. 3.2) explicitly discusses the overheads with pattern matching that pattern synonyms arguably solve.

emilaxelsson commented 10 years ago

Thanks for the suggestion!

I've looked very quickly at pattern synonyms before, but haven't tried to use them in Syntactic. I like your example. I wasn't aware that they could be combined with view patterns in the way that you do. Very nice!

If you want, you could add a file under examples demonstrating pattern synonyms. Pull requests are welcome!