
27 Jun
2010
27 Jun
'10
5:58 a.m.
Is there a way to write the function process :: [(Location,Item)] -> [(Location,ValuableItem)] given a function indicating which Item's to keep transform :: Item -> Maybe ValuableItem using functors and arrows? The value for location stays with any item that is kept. What I have is process inp = catMaybes (map g inp) where g (l,i) = case transform i of Nothing -> Nothing Just v -> Just (l,v) This looks like an arrow situation to me because you want to make a function that acts on the second value in a tuple, and a little bit like a Maybe functor. Thanks, Mike