[GHC] #1974: length "foo" doesn't work with -XOverloadedStrings
GHC
trac at galois.com
Wed Dec 12 09:34:26 EST 2007
#1974: length "foo" doesn't work with -XOverloadedStrings
-----------------------------+----------------------------------------------
Reporter: ganesh | Owner:
Type: feature request | Status: new
Priority: low | Milestone:
Component: Compiler | Version: 6.8.1
Severity: minor | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Architecture: Unknown
Os: Unknown |
-----------------------------+----------------------------------------------
Comment (by simonpj):
Fair enough. Would you care to specify the new defaulting rule? The
starting points are:
0. http://www.haskell.org/ghc/docs/latest/html/users_guide/interactive-
evaluation.html#extended-default-rules
0. http://www.haskell.org/ghc/docs/latest/html/users_guide/type-class-
extensions.html#overloaded-strings
In particular, (1) requires the constraints to be of form (C a), where 'a'
is a type variable; whereas you want it to be of form (C ty), where ty is
a type. You probably want the type to have at most one free variable, to
avoid complicated interactions between defaults.
But what if the constraints are `(IsString [a], Eq a)`. Then to try a
candidate default type, say `[Char]` we presumably match `[a]` against
`[Char]`, and everything works out. But if the `(Eq a)` was first, we
might try matching `a` against `[Char]`, which doesn't work. So perhaps
each candidate type must be matched against each constraint (and if the
match succeeds, try to solve the constraints under that substitution)?
If you write the spec, I'm pretty sure it'll be easy enough to implement.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1974#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list