
27 Jun
2010
27 Jun
'10
7:38 a.m.
Hi Michael The /case transform i of .../ code should be able to be rephrased with fmap as it is "putting back" the first element of the tuple if /transform/ produces a (Just) value. fmap (\a -> (a,v)) Personally, I would look to avoiding building the list of type ::Maybe (Location,ValuableItem) during the first traversal (via map) to later filter them out with a second traversal via catMaybes. The optimization technique "stream fusion" can often collapse compositions of list functionals (map, filter, etc). into one traversal. But it isn't available by default - you have to install the stream-fusion library. Also a composition of functionals isn't necessarily clearer than a direct implementation. Best wishes Stephen