[GHC] #1974: length "foo" doesn't work with -XOverloadedStrings

GHC cvs-ghc at haskell.org
Fri Sep 7 03:49:43 CEST 2012


#1974: length "foo" doesn't work with -XOverloadedStrings
---------------------------------+------------------------------------------
    Reporter:  ganesh            |       Owner:                  
        Type:  feature request   |      Status:  new             
    Priority:  normal            |   Milestone:  _|_             
   Component:  Compiler          |     Version:  6.8.1           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by parcs):

 Have you considered changing the instance declaration from

 {{{
 instance IsString String where
 }}}

 to

 {{{
 instance (a ~ Char) => IsString [a] where
 }}}

 This new instance will make `length "foo"` happily typecheck, but it will
 also overlap with other `IsString` instances of the form `[T]`. (Though I
 don't think such instances are common in practice.)

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



More information about the Glasgow-haskell-bugs mailing list