It seems reasonable that filter should be generic. The
  underlying container need only support some kind of traversal,
  a zero element and a concatenation that eliminates zeroes.

  A `Monad` provides traversal via `join` and `fmap`; the
  remaining qualities are satisfied by `MonadPlus`. I've put
  together an implementation of `filter` for `MonadPlus` that
  works well enough for lists (though it presents somewhat
  greater obstacles to efficient compilation).

  I'm not sure whether `filter` is important enough to warrant
  its own generics package -- it's one of many collection
  operations that need to be generified. I'd like to know what
  folks think about the use of `MonadPlus` in this case.

--
Jason Dusek


 |...an implementation of `filter`...|
  
http://github.com/jsnx/genfil/blob/246026b975ec13587186681b7b346ae1e440d0c9/Data/Filter.hs
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to