[Haskell-cafe] Fw: [darcs-devel] "Inferred type is less
polymorphic than expected" and type witnesses
ryani.spam at gmail.com
Mon Jan 12 13:05:37 EST 2009
Some questions first:
What's the type of this function supposed to be?
What's the type of unsafeCompare?
How is the data type with NilFL and :>: defined?
On Mon, Jan 12, 2009 at 5:43 AM, Rob Hoelz <rob at hoelzro.net> wrote:
> 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
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe