[GHC] #12828: Generalize functions from Data.Maybe (‘catMaybes’, ‘mapMaybe’)

GHC ghc-devs at haskell.org
Sat Nov 12 01:50:41 UTC 2016


#12828: Generalize functions from Data.Maybe (‘catMaybes’, ‘mapMaybe’)
-------------------------------------+-------------------------------------
           Reporter:  Iceland_jack   |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  lowest         |         Milestone:
          Component:  Core           |           Version:  8.0.1
  Libraries                          |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Opening a ticket for discussion. As mentioned in
 [https://www.reddit.com/r/haskell/comments/2y2pe5/shouldnt_ftp_propagate_changes_over_the_entire/cp6vpb4/
 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]
 mapMaybes :: (Foldable f, Foldable g) => (a -> f b) -> (f a -> [b])
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12828>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list