[Haskell-cafe] Problem type checking class-method implementation
Stefan Holdermans
stefan at cs.uu.nl
Wed Aug 3 07:22:46 EDT 2005
Ralf,
> The problem is the type-scheme polymorphic result type of
> castItem which is consumed by a type-variable polymorphic
> but type-class bounded argument type of process.
Thanks for your explanation: I hope it's still safe to say that I did
not miss something entirely obvious. :) Anyway, indeed, I do see
bubbling that one type-class constraint to the top-level.
So, playing around, rewriting things just a little, I end up with
instance IsProcessor p (Processor p) where
process = Processor . unwrap . processItem
which is disappointingly the most obvious implementation anyway.
Disappointingly, however, because it equivalent to what I had written
in the original program, i.e., the one that brought me to consider all
this in the first place. And there, for some reason, it did not work
and led me to the deviation via (something equivalent to) castItem.
Well, that's what you get from simplifying stuff. Anyway, it seems time
to have another look at the original program and maybe come with
another type-checking puzzle later. ;)
Thanks,
Stefan
http://www.cs.uu.nl/~stefan/
More information about the Haskell-Cafe
mailing list