[GHC] #9586: Implement Traversable/Foldable-Burning-Bridges Proposal

GHC ghc-devs at haskell.org
Thu Sep 18 20:31:36 UTC 2014


#9586: Implement Traversable/Foldable-Burning-Bridges Proposal
-------------------------------------+-------------------------------------
              Reporter:  hvr         |            Owner:  hvr
                  Type:  task        |           Status:  new
              Priority:  normal      |        Milestone:  7.10.1
             Component:              |          Version:
  libraries/base                     |         Keywords:
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Difficult (2-5
  Unknown/Multiple                   |  days)
       Type of failure:              |       Blocked By:
  None/Unknown                       |  Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:  Phab:D209   |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 I think if you're doing this, it would make sense to generalize these too:

 {{{#!hs
 null :: (Foldable f) => f a -> Bool
 null = foldr (const True) False

 length :: (Foldable f) => f a -> Int
 length = foldl' (\k _ -> k + 1) 0

 --and even though it's a very strange thing already
 genericLength :: (Foldable f, Num n) => f a -> n
 genericLength = foldr (\_ k -> 1 + k) 0
 }}}

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


More information about the ghc-tickets mailing list