[Haskell] Views in Haskell

Philippa Cowderoy flippa at flippac.org
Wed Jan 24 18:39:32 EST 2007


On Wed, 24 Jan 2007, Claus Reinke wrote:

> the alternative I'm aiming for, as exhibited in the consP example, would be
> to build patterns systematically from view patterns used as abstract
> de-constructors, composed in the same way as one would compose the
> abstract constructors to build the abstract data structure. in other words,
> you define your pattern constructors once, with the adt, and export them;
> and anytime you want to match somethind of that abstract type, you simply
> compose your pattern from those abstract pattern constructors.
> 

This would cause an awful lot of kludging to get around the fact you need 
to declare a new ADT to declare new abstract deconstructors, and requires 
an additional extension for abstract deconstructors to be typeclass 
methods - something abstract constructors can do for free. Neither seems 
gainful to me.

-- 
flippa at flippac.org

Performance anxiety leads to premature optimisation


More information about the Haskell-prime mailing list