Hi All I'm having some difficulty with typeclasses.
What I'm trying to do should be obvious, but it's still giving me
trouble. I want to take a packaged item, and strengthen the
constraints on its type. Rather than being just any type that is an
instance of A, I want to do a runtime check and do something different
if it is a type that is also an instance of B (which implies that it
is an instance of A also).
I've attached some code that attempts this, but ghci (er, 6.4.2 with
-fglasgow-exts) complains:
Compiling Main ( Cast.hs, interpreted )
Cast.hs:15:22:
Ambiguous type variable `b' in the constraint:
`B b' arising from use of `qux' at Cast.hs:15:22-24
Probable fix: add a type signature that fixes these type variable(s)
Failed, modules loaded: none.
So, can anyone suggest how I can achieve my goal?
thanks,
Tom
Cast.hs
Description: Binary data
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
