[Haskell-cafe] Fw: [darcs-devel] "Inferred type is less polymorphic than expected" and type witnesses

Rob Hoelz rob at hoelzro.net
Mon Jan 12 08:43:42 EST 2009


Forwarding to Haskell Cafe per Eric's suggestion.

Begin forwarded message:

Date: Sun, 11 Jan 2009 23:01:31 -0600
From: Rob Hoelz <rob at hoelzro.net>
To: darcs-devel at darcs.net
Subject: [darcs-devel] "Inferred type is less polymorphic than
expected" and type witnesses


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
_______________________________________________
darcs-devel mailing list (AUTOMATIC POSTINGS ONLY PLEASE!)
darcs-devel at darcs.net
http://lists.osuosl.org/mailman/listinfo/darcs-devel


More information about the Haskell-Cafe mailing list