[GHC] #9623: Use Data.List.dropWhileEnd

GHC ghc-devs at haskell.org
Sun Sep 21 17:10:51 UTC 2014


#9623: Use Data.List.dropWhileEnd
-------------------------------------+-------------------------------------
              Reporter:  dfeuer      |            Owner:
                  Type:  task        |           Status:  new
              Priority:  normal      |        Milestone:  7.10.1
             Component:  libraries   |          Version:  7.8.3
  (other)                            |         Keywords:
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Easy (less than 1
  Unknown/Multiple                   |  hour)
       Type of failure:              |       Blocked By:
  None/Unknown                       |  Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
Changes (by thomie):

 * status:  patch => new
 * component:  Compiler => libraries (other)


Comment:

 So `dropWhileEnd` was not added to base until version 4.5 (ghc 7.4), so to
 allow compilation with older versions of ghc, it would have to be
 conditionally imported and defined in the files you changed:
 {{{#!haskell
 #if MIN_VERSION_base(4,5,0)
 import Data.List(dropWhileEnd)
 #endif
 }}}
 {{{#!haskell
 #if !MIN_VERSION_base(4,5,0)
 dropWhileEnd :: (a -> Bool) -> [a] -> [a]
 dropWhileEnd p = foldr (\x xs -> if p x && null xs then [] else x : xs) []
 #endif
 }}}

 And most of these patches should go to Github, since that is where those
 projects are maintained: [http://github.com/haskell/cabal cabal],
 [http://github.com/haskell/filepath filepath],
 [http://github.com/haskell/haddock haddock] and
 [http://github.com/judah/haskeline haskeline].

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


More information about the ghc-tickets mailing list