
21 Jun
2007
21 Jun
'07
3:39 p.m.
Bulat Ziganshin wrote:
Hello Cristiano,
Thursday, June 21, 2007, 4:46:27 PM, you wrote:
class FooOp a b where foo :: a -> b -> IO ()
instance FooOp Int Double where foo x y = putStrLn $ (show x) ++ " Double " ++ (show y)
this is rather typical question :) unlike C++ which resolves any overloading at COMPILE TIME, selecting among CURRENTLY available overloaded definitions and complaining only when when this overloading is ambiguous, type classes are the RUN-TIME overloading mechanism
As I understood it, it was at COMPILE TIME (i.e. no type witness) whenever explicitly type-annotated, implicitly when not exported from a module, or when inlined at the call site, at least in GHC. Or did I get this wrong? Dan