On Friday 22 October 2010 7:24:37 am Max Bolingbroke wrote:
> Ah yes, pattern synonyms. This solution is somewhat unsatisfying
> because you will also need some smart constructors:
> 
> """
> nil = Roll NilF
> cons x xs = Roll (ConsF x xs)
> """
> 
> Now the names of the smart constructors for building the data type are
> not the same as the things you pattern match on, which is a slightly
> annoying asymmetry. It's certainly less complicated than the
> TypeFamilies based solution though!

SHE's pattern synonyms also work as expressions, so there's no asymmetry. They 
work just like constructors as far as I can tell (with what little I've played 
with them); you can even partially apply them (in expressions). It doesn't do 
infix synonyms currently, though.

-- Dan
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to