[darcs-devel] "Inferred type is less polymorphic than expected" and type witnesses

Rob Hoelz rob at hoelzro.net
Mon Jan 12 05:01:31 UTC 2009


Hello again, Darcs users and developers,

As I mentioned in my last e-mail, I'm working on
http://bugs.darcs.net/issue291.  It's actually gone pretty well, and I
feel I'm just about finished (I've done all but sorting out the
changes after leaving the editor), only I've encountered the compiler
error you see in the subject of this message. This error only appears
when compiling with witnesses. Here's the source for the function
that it's complaining about:

compare_changes_with_old (x :>: xs) (y :>: ys) =
  case compare_changes_with_old xs ys of
    nx :> ny -> if unsafeCompare x y
      then ((x :>: nx) :> ny)
      else (NilFL :> (y :>: ys))
compare_changes_with_old NilFL NilFL = (NilFL :> NilFL)
compare_changes_with_old NilFL ys@(_ :>: _) = (NilFL :> ys)
compare_changes_with_old x@(_ :>: _) NilFL = (NilFL :> NilFL)

Now, I have two questions:

1) What exactly does this error mean, and how do I get around it?
2) What are witness types, and what are they used for?

I will gladly accept links to fine manuals as answers to either
question, but simple explanations would be nice. =D  I thought I
understood Haskell pretty well, but existentially qualified types have
thrown me for a loop.

Thanks much,
Rob Hoelz


More information about the darcs-devel mailing list