On Fri, 2009-03-27 at 12:26 +0100, Henning Thielemann wrote: > On Thu, 26 Mar 2009, wren ng thornton wrote: > > > Functions like uncons and viewL are nicer (because they're safe), but they > > can have overhead because they're unnecessarily complete (e.g. the Maybe > > wrapper can be avoided if we know a-priori that Just will be the > > constructor > > used). > > If you know, it's always Just, then don't use Maybe. There must be some > point in your program, from where it is sure, that it is always Just and > that is the point where to leave Maybe. When I searched my old code for > fromJust and head and review it carefully, I could eliminate them in most > cases. > > In another thread (Grouping - Map/Reduce)
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])] Duncan _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
