[GHC] #1544: Derived Read instances for recursive datatypes with infix constructors are too inefficient

GHC trac at galois.com
Mon Aug 20 17:30:52 EDT 2007


#1544: Derived Read instances for recursive datatypes with infix constructors are
too inefficient
-------------------------------------+--------------------------------------
    Reporter:  jcpetruzza at gmail.com  |        Owner:         
        Type:  bug                   |       Status:  new    
    Priority:  normal                |    Milestone:  6.8    
   Component:  Compiler              |      Version:  6.6.1  
    Severity:  normal                |   Resolution:         
    Keywords:                        |   Difficulty:  Unknown
          Os:  Unknown               |     Testcase:         
Architecture:  Unknown               |  
-------------------------------------+--------------------------------------
Old description:

> Consider this definition:
> {{{
> data Exp = C | Exp :+: Exp | Exp :-: Exp deriving ( Read, Show )
> }}}
> Now, try something like:
> {{{
> > read "((((((((((C))))))))))" :: T
> }}}
> Even this simple expression may take several seconds to parse. It gets
> worse if you keep adding parenthesis. And even worse if you add more
> infix constructors....

New description:

 Consider this definition:
 {{{
 data Exp = C | Exp :+: Exp | Exp :-: Exp deriving ( Read, Show )
 }}}
 Now, try something like:
 {{{
 > read "((((((((((C))))))))))" :: Exp
 }}}
 Even this simple expression may take several seconds to parse. It gets
 worse if you keep adding parenthesis. And even worse if you add more infix
 constructors....

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


More information about the Glasgow-haskell-bugs mailing list