On 06/03/07, Simon Peyton-Jones [EMAIL PROTECTED] wrote:
4. The rigid type variable thing isn't just an implementation question.
What *would* you like the error message to say when you write
f :: ([a], Int) - Int
f (x:xs, y) = x+y
Here we unify 'a' with Int, which is wrong.
| 4. The rigid type variable thing isn't just an implementation question.
What *would* you like the
| error message to say when you write
| f :: ([a], Int) - Int
| f (x:xs, y) = x+y
| Here we unify 'a' with Int, which is wrong. What would a nicer error
message say?
|
|
On 06/03/07, Simon Peyton-Jones [EMAIL PROTECTED] wrote:
I'm not against adding type is too monomorphic or something like that if you
think it'd help, but I'd like to say something about the incompatibility of 'a' and
'Int'. No?
Here's a proper draft, then.
Foo.hs:
foo :: [a] -- line 1
foo
Error message:
Inferred type is not as polymorphic as type signature claims.
Inferred type: [Char]
Expected type: [a]
Provided by the type signature:
foo :: [a]
at ~/foo.hs:1
(`a', a polymorphic type variable, could not be unified with `Char', a
monotype.)
In the expression: hello at
On Mar 6, 2007, at 22:47 , Claus Reinke wrote:
ps. i was somewhat shocked to read that SPJ wants FDs gone.
Why? Simon has good taste. :)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
too complicated? more explanation isn't always more helpful. the user is
confused
at this point, and more information might mean more confusion.
That is true, but my experience is that when an error message perplexes
me I need all the suggestions
ps. i was somewhat shocked to read that SPJ wants FDs gone.
Why? Simon has good taste. :)
de gustibus non est disputandum ;)
FD have uses and problems and AT have uses and problems. starting anew
with the latter doesn't fix the problems, it just changes their form.
if AT are meant to
| class Foo a b | a - b
| instance Foo Int String
| bar :: Foo Int b = b
| bar = rargh
| There is nothing wrong with this program. I have run into this
| problem and I consider it to be a bug/weakness of the type checking
| algorithm used by the implementation.
|
| (I also agree with you
Hello,
There is nothing wrong with this program. I have run into this
problem and I consider it to be a bug/weakness of the type checking
algorithm used by the implementation.
(I also agree with you that the term rigid variable is rather
confusing because it is an artifact of the type
class Foo a b | a - b
instance Foo Int String
bar :: Foo Int b = b
bar = rargh
Is there any reason why that shouldn't work? GHC gives one of its
silly b is a rigid variable errors (aside: that's a really confusing
error; I'd prefer something like Hugs's Infered type is not general
enough).
--
On 03/03/07, Bryan Burgers [EMAIL PROTECTED] wrote:
As far as I know, you should be defining the type of bar in the class
declaration for Foo, not in an instance declaration.
I think I over-reduced my problem. Here's a more complex issue that
can't be resolved by moving bar to be a method of
11 matches
Mail list logo