[Haskell-cafe] Re: Type family problem

2009-01-21 Thread Gleb Alexeyev

Sjoerd Visscher wrote:

When I try this bit of code:

  class C1 a where
type F a :: *
x :: F a
y :: F a
x = y

I get this error:

Couldn't match expected type `F a1' against inferred type `F a'
In the expression: y
In the definition of `x': x = y

I can't figure out what is going on or how I should fix this.



The discussion [1] seems to be related.

[1] http://hackage.haskell.org/trac/ghc-test/ticket/2855

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


Re: [Haskell-cafe] Re: Type family problem

2009-01-21 Thread Manuel M T Chakravarty

Gleb Alexeyev:

Sjoerd Visscher wrote:

When I try this bit of code:
 class C1 a where
   type F a :: *
   x :: F a
   y :: F a
   x = y
I get this error:
   Couldn't match expected type `F a1' against inferred type `F a'
   In the expression: y
   In the definition of `x': x = y
I can't figure out what is going on or how I should fix this.


The discussion [1] seems to be related.

[1] http://hackage.haskell.org/trac/ghc-test/ticket/2855


Exactly.  See also the related ticket

  http://hackage.haskell.org/trac/ghc-test/ticket/1897

In short, the signature F a is ambiguous (as `a' only occurs as a  
parameter of a synonym family in the signature).  Functions with an  
ambiguous signature are generally unusable (even if the compiler  
accepts the definition initially).


Manuel

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