
28 Mar
2009
28 Mar
'09
4:41 a.m.
Duncan Coutts
Yes, grouping is the one where I most often find the need for head or partial patterns. The function group produces a list of non-empty lists but that is not reflected in the type. On the other hand, actually reflecting it in the type would make it more awkward:
group :: Eq a => [a] -> [(a,[a])]
group :: Eq a => [a] -> [(a,Int)] ? This is often what I want anyway :-) Of course, this only works for sane Eq instances. -k -- If I haven't seen further, it is by standing in the footprints of giants