[Haskell-cafe] Re: [Haskell] View patterns in GHC: Request for feedback

Dan Licata drl at cs.cmu.edu
Fri Jul 27 05:22:37 EDT 2007


On Jul26, Stefan O'Rear wrote:
> > So, this syntax affects a lot of code, existing or otherwise, that
> > doesn't use view patterns, which is something we're trying to avoid.
> 
> Eh?  I *think* the typing rules are the same for the no-view case.  If
> the auto-deriving hack isn't implemented, you only need a
> deriving(View), otherwise there should be no change at all...

Assuming you don't have the functional dependency: "affects" in the
sense that any code you write has a generalized type, so you have to
explain view patterns to beginners right out of the gate, etc.  If you
write 

length [] = []
length (h : t) = 1 + length t

we don't want to have to explain to beginners why it has type

length :: forall a,b,c. View a [b] -> a -> Num c

-Dan


More information about the Haskell-Cafe mailing list