Re: Typechecker / OverloadedStrings question 7.8 vs. 7.10

2015-08-03 Thread Phil Ruffwind
Would someone feel able to open a Trac ticket summarising this thread (as well as pointing to it), and making a proposal? Done: https://ghc.haskell.org/trac/ghc/ticket/10733 ___ ghc-devs mailing list ghc-devs@haskell.org

Re: Typechecker / OverloadedStrings question 7.8 vs. 7.10

2015-08-03 Thread Phil Ruffwind
Like this? Either use a type annotation to specify what 't0' should be based on these potential instance(s): instance Foo Bar -- Defined in 'Foo.Bar' ... and possibly more from other modules that the compiler has not yet encountered or define the required

Re: Typechecker / OverloadedStrings question 7.8 vs. 7.10

2015-08-03 Thread Daniel Bergey
On 2015-08-02 at 23:17, Reid Barton rwbar...@gmail.com wrote: It may be worth noting that the existing error message is actually technically correct, in the sense that what would be needed for the program to compile is exactly an instance of the form instance Foldable t where Then the

Re: Typechecker / OverloadedStrings question 7.8 vs. 7.10

2015-08-03 Thread Iavor Diatchki
Hello, what Reid says is exactly right---the issue is not really about what instances are present, the problem is that GHC can't determine how to instantiate `t0`. Perhaps a more direct way to describe this is as follows: Failed to infer type `t0` while solving constraint `Data.String.IsString

Re: Typechecker / OverloadedStrings question 7.8 vs. 7.10

2015-08-03 Thread Reid Barton
On Mon, Aug 3, 2015 at 12:43 AM, Phil Ruffwind r...@rufflewind.com wrote: I think the error message could be made clearer simply by emphasizing the fact that type ambiguity over the lack of instances. Ambiguous type variable 't0' arising from a use of elem :: a - t0 a - Bool

Re: Typechecker / OverloadedStrings question 7.8 vs. 7.10

2015-08-03 Thread Daniel Bergey
On 2015-08-03 at 04:43, Phil Ruffwind r...@rufflewind.com wrote: I think the error message could be made clearer simply by emphasizing the fact that type ambiguity over the lack of instances. Ambiguous type variable 't0' arising from a use of elem :: a - t0 a - Bool caused by

Re: Typechecker / OverloadedStrings question 7.8 vs. 7.10

2015-08-03 Thread Brandon Allbery
On Mon, Aug 3, 2015 at 12:45 PM, Daniel Bergey ber...@teallabs.org wrote: I thought GHC would infer the type when only one instance is in scope, at least in some cases, like IsString. But I could well be wrong about that. Typeclasses are open-world; this is not a safe assumption, since

RE: Typechecker / OverloadedStrings question 7.8 vs. 7.10

2015-08-03 Thread Simon Peyton Jones
Ruffwind; Reid Barton | Cc: ghc-devs | Subject: Re: Typechecker / OverloadedStrings question 7.8 vs. 7.10 | | On 2015-08-03 at 04:43, Phil Ruffwind r...@rufflewind.com wrote: | I think the error message could be made clearer simply by emphasizing | the fact | that type ambiguity over the lack

Re: Typechecker / OverloadedStrings question 7.8 vs. 7.10

2015-08-02 Thread Phil Ruffwind
I think the error message could be made clearer simply by emphasizing the fact that type ambiguity over the lack of instances. Ambiguous type variable 't0' arising from a use of elem :: a - t0 a - Bool caused by the lack of an instance 'Data.String.IsString (t0 Char)' Either add

RE: Typechecker / OverloadedStrings question 7.8 vs. 7.10

2015-08-02 Thread Daniel Bergey
On 2015-07-31 at 08:59, Simon Peyton Jones simo...@microsoft.com wrote: Daniel Bergey wrote: | How hard would it be to give a different error message instead of No | instance ... when the type variable is ambiguous? I always find this | error slightly misleading, since it seems to me that

Re: Typechecker / OverloadedStrings question 7.8 vs. 7.10

2015-08-02 Thread Reid Barton
On Sun, Aug 2, 2015 at 12:58 PM, Daniel Bergey ber...@teallabs.org wrote: On 2015-07-31 at 08:59, Simon Peyton Jones simo...@microsoft.com wrote: Daniel Bergey wrote: | How hard would it be to give a different error message instead of No | instance ... when the type variable is

RE: Typechecker / OverloadedStrings question 7.8 vs. 7.10

2015-07-31 Thread Simon Peyton Jones
it to say? I think it likely we could make it say that! S | -Original Message- | From: Daniel Bergey [mailto:ber...@teallabs.org] | Sent: 31 July 2015 02:23 | To: Michael Karg; Simon Peyton Jones | Cc: ghc-devs | Subject: Re: Typechecker / OverloadedStrings question 7.8 vs. 7.10

Typechecker / OverloadedStrings question 7.8 vs. 7.10

2015-07-30 Thread Michael Karg
Hi devs, in the followin snippet: {-# LANGUAGE OverloadedStrings #-} import Data.Char (isAlphaNum) import Data.ByteString.Char8 as BS (all) main = print $ check str where check = BS.all (\x - x `elem` valid || isAlphaNum x) -- Line 7 valid = $_- -- ::

Re: Typechecker / OverloadedStrings question 7.8 vs. 7.10

2015-07-30 Thread Daniel Bergey
On 2015-07-30 at 21:39, Michael Karg mgoreme...@gmail.com wrote: I guess without that pragma, the string literals already imply t ~ [] for Foldable t. You're basically right. Without OverloadedStrings, a string literal (foo) is always a String. With OverloadedStrings, it's free to be any t