> > f ~(x:xs) = x + 2 > f ~[] = 42 > > Then f [] would give a complie error: > Irrefutable pattern failed for pattern (x : xs)
Sorry, that should be *runtime* error! Chris. > > Hope that gives some insight. > Chris. > > > > > > Oh well, the way it is now is also easy to get used to, one just has to > > know how it works (just like M-theory ;-) ) > > > > Cheers, > > Peter > > > > > > Neil Mitchell wrote: > > > Hi > > > > > > > > >>> Now why isn't pattern matching lazy by default? This seems odd for a > > >>> newbie since everything else is lazy by default. > > >>> > > > > > > f ~(x:xs) = rhs > > > f ~[] = rhs' > > > > > > Now guess what f [] does... > > > > > > If you use a where binding then pattern matching is lazy. > > > > > > Thanks > > > > > > Neil > > > > > > > > > > > > > > _______________________________________________ > Haskell-Cafe mailing list > [email protected] > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
