[GHC] #11284: Lambda-lifting fails in simple Text example

GHC ghc-devs at haskell.org
Thu Dec 24 16:18:47 UTC 2015


#11284: Lambda-lifting fails in simple Text example
-------------------------------------+-------------------------------------
           Reporter:  bgamari        |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  7.10.3
           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:
-------------------------------------+-------------------------------------
 Consider the example,
 {{{#!hs
 import Data.Char (isSpace)
 import Data.List (foldl')
 import GHC.Exts (build)
 import qualified  Data.Text as T

 longestWord :: T.Text -> Int
 longestWord t = foldl' max 0 $ map T.length $ fusedWords t

 fusedWords :: T.Text -> [T.Text]
 fusedWords t0 = build $ \cons nil ->
   let go !t
         | T.null t  = nil
         | otherwise = let (w, rest) = T.span (not . isSpace) t
                       in cons w (go $ T.dropWhile isSpace rest)
   in go t0
 }}}

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


More information about the ghc-tickets mailing list