RE: [Haskell-cafe] Re: problem with collection (container) class

2008-02-18 Thread Simon Peyton-Jones
Good point. Happily I improved the error message a couple of weeks ago, so 
it'll be better in the next release

Simon

| -Original Message-
| From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Daniel Fischer
| Sent: 08 February 2008 22:24
| To: Ben Franksen; haskell-cafe@haskell.org
| Subject: Re: [Haskell-cafe] Re: problem with collection (container) class
|
| Am Freitag, 8. Februar 2008 22:14 schrieb Ben Franksen:
|  If it's a bug then it is probably in 6.6.1 too, it just gets hidden by the
|  fact that in 6.6.1 the -fglasgow-exts extensions cannot be activated
|  separately. If you enable one of them, you get them all.
| 
| Thanks for the info, didn't know that.
|
| The problem was the error message, which didn't mention that each type
| variable may appear only once in an instance head, which I had temporarily
| forgotten. Then the message
|
| Leandro.hs:32:0:
| Illegal instance declaration for `Container (Abb a b) a b'
| (All instance types must be of the form (T a1 ... an)
|  where a1 ... an are distinct type *variables*
|  Use -XFlexibleInstances if you want to disable this.)
| In the instance declaration for `Container (Abb a b) a b'
|
| looks rather confusing :)
|
|  Cheers
|  Ben
| 
| Cheers,
| Daniel
| ___
| Haskell-Cafe mailing list
| Haskell-Cafe@haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-cafe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: problem with collection (container) class

2008-02-08 Thread Daniel Fischer
Am Freitag, 8. Februar 2008 22:14 schrieb Ben Franksen:
 If it's a bug then it is probably in 6.6.1 too, it just gets hidden by the
 fact that in 6.6.1 the -fglasgow-exts extensions cannot be activated
 separately. If you enable one of them, you get them all.

Thanks for the info, didn't know that. 

The problem was the error message, which didn't mention that each type 
variable may appear only once in an instance head, which I had temporarily 
forgotten. Then the message

Leandro.hs:32:0:
Illegal instance declaration for `Container (Abb a b) a b'
(All instance types must be of the form (T a1 ... an)
 where a1 ... an are distinct type *variables*
 Use -XFlexibleInstances if you want to disable this.)
In the instance declaration for `Container (Abb a b) a b'

looks rather confusing :)

 Cheers
 Ben

Cheers,
Daniel
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: problem with collection (container) class

2008-02-08 Thread Ben Franksen
Daniel Fischer wrote:
 {-# LANGUAGE MultiParamTypeClasses #-}
 {-# LANGUAGE FunctionalDependencies #-}
 {- # LANGUAGE FlexibleInstances # -}
 module Leandro where
 
 data Abb a b = Branch a b (Abb a b) (Abb a b) | Leaf
 
 data ListAssoc a b = Node a b (ListAssoc a b) | Empty
 
 class Container c a b |c - a, c - b where
 [...]
 
 instance (Ord a) = Container (Abb a b) a b where
 [...]
 
 Note: The FlexibleInstances Language pragma is required by GHC 6.8.1 and
 6.8.2, but not by GHC 6.6.1 or hugs, I think that's a bug in 6.8.*

If it's a bug then it is probably in 6.6.1 too, it just gets hidden by the
fact that in 6.6.1 the -fglasgow-exts extensions cannot be activated
separately. If you enable one of them, you get them all.

Cheers
Ben

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe