[GHC] #11303: Pattern matching against sets of strings sharing a prefix blows up pattern checker

GHC ghc-devs at haskell.org
Mon Jan 4 22:52:48 UTC 2016


#11303: Pattern matching against sets of strings sharing a prefix blows up pattern
checker
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  7.11
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |            Test Case:  T11303
      Blocked By:                    |             Blocking:
 Related Tickets:  #11302            |  Differential Rev(s):  Phab:D1716,
       Wiki Page:                    |  Phab:D1719
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Hm, for some reason, this program still seems to be blowing up GHC even
 with the latest changes:

 {{{#!hs
 {-# LANGUAGE TypeFamilies #-}
 module Slow where

 data family Letter a

 data instance Letter a = A | B | C | D | E | F | G | H | I | J

 f :: [Letter a] -> Int
 f = foldl go 0
   where
     go n letter = n + n'
       where
         n' = case letter of
                   A -> 0
                   B -> 1
                   C -> 2
                   D -> 3
                   E -> 4
                   F -> 5
                   G -> 6
                   H -> 7
                   I -> 8
                   J -> 9
 }}}

 This time, adding explicit type signatures to `go` and/or `n'` does
 ''not'' make it work.

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


More information about the ghc-tickets mailing list