Wren ng thornton wrote:

> It compiles just fine with (DeriveType A b => b -> b) after all, which 
> resolves directly to (B -> B)

That's not the case:

simpleNarrow :: DeriveType A b => b -> b
simpleNarrow = id

 Couldn't match expected type `b' (a rigid variable)
           against inferred type `B'
      `b' is bound by the type signature for `simpleNarrow' ...
    When using functional dependencies to combine
      DeriveType A B, arising from the instance declaration ...
      DeriveType A b, arising from is bound by the type signature for
`simpleNarrow' ...

I think Bryan got the order in which type inference/checking works
wrong. The dependency is not "resolved" before calculating the type as
he suggested.

>*Main> someDestructor (SomeConstructor undefined undefined :: ComplexType A)
 >  B

Why not this:

*Main>  someDestructor (SomeConstructor A B)
 B

> But if you have actual values rather than just unit types, note that this
> won't work:
>
>  > instance DeriveType A B where
>  >     someDestructor (SomeConstructor _ b) = b

I couldn't understand the sentence "actual values rather than unit
types". What do you have in mind?

P.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to