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

#1974: length "foo" doesn't work with -XOverloadedStrings -------------------------------------+------------------------------------- Reporter: ganesh | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: ⊥ Component: Compiler | Version: 6.8.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by sjakobi): * status: new => closed * resolution: => fixed Comment: Replying to [comment:9 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.)
That change with in GHC-8.0 / base-4.9: {{{#!hs GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
length "foo" 3 }}}
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/1974#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC