
#12828: Generalize functions from Data.Maybe (‘catMaybes’, ‘mapMaybe’) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: feature request | Status: new Priority: lowest | Milestone: Component: Core Libraries | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by Iceland_jack: @@ -16,1 +16,1 @@ - mapMaybes :: (Foldable f, Foldable g) => (a -> f b) -> (f a -> [b]) + mapMaybe :: (Foldable f, Foldable g) => (a -> f b) -> (f a -> [b]) New description: Opening a ticket for discussion. As mentioned in [https://www.reddit.com/r/haskell/comments/2y2pe5/shouldnt_ftp_propagate_chan... this comment], more functions can be generalized to `Foldable` {{{#!hs catMaybes :: Foldable f => f (Maybe a) -> [a] mapMaybe :: Foldable f => (a -> Maybe b) -> (f a -> [b]) listToMaybe :: Foldable f => f a -> Maybe a }}} I think `catMaybes` and `mapMaybe` are fine candidates. The comment offers more extreme changes, {{{#!hs catMaybes :: (Foldable f, Foldable g) => Foldable f => f (g a) -> [a] mapMaybe :: (Foldable f, Foldable g) => (a -> f b) -> (f a -> [b]) }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12828#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler