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

GHC ghc-devs at haskell.org
Sat Nov 12 01:54:27 UTC 2016


#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:

@@ -15,1 +15,1 @@
- catMaybes :: (Foldable f, Foldable g) => Foldable f => f (g a) -> [a]
+ catMaybes :: (Foldable f, Foldable g) => f (g a) -> [a]

New description:

 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) => 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:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list