[Haskell-cafe] Functional dependence nightmare

Edgar Gomes Araujo talktoedgar at gmail.com
Sat Mar 26 21:10:00 CET 2011

Unfortunately it didn't work.
The error message is not so clear to me and my understanding in advanced
Haskell type system is yet to weak to figure out what is going on.

Looking at the error messages seems that the type inference analyzes the
code in two different direction and finds some inconsistency at some
junction point.

    Couldn't match type `Unit subUnit3' with `Unit subUnit2'
    NB: `Unit' is a type function, and may not be injective

How can I say that "Unit subUnit3" is "Unit subUnit2"?

The type of error message seems be caused by a very similar problem

Could not deduce (a1 ~ ActiveSubUnit subUnit3)
  Expected type: SetActiveSubUnits a
  Actual type: Set (ActiveSubUnit subUnit3)

since "SetActiveSubUnits a" and "Set (ActiveSubUnit subUnit3)"  should have
the same type.

Any new idea ?


Edgar Gomes

On 26 March 2011 16:13, Stephen Tetley <stephen.tetley at gmail.com> wrote:

> For the specific error at line 265 I think you should be using
> ScopedTypeVariables and properly qualifying the type signature at the
> function level with a forall.
> The local annotation { ::(SubUnit a)=> } is presumably introducing
> another type variable unrelated to 'a' in the function level type
> signature.
> Note, my suggestion is "by eye" -  I haven't run the code, so it may
> not work or there may be other errors.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110326/fad86416/attachment.htm>

More information about the Haskell-Cafe mailing list