Hello Dan,

Thursday, June 21, 2007, 7:39:35 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?

overloading rules are general and they should work in any situation.
generally speaking, you define POLYMORPHIC function which will work
with any instance of FooOp class. there is no way to force GHC to use
ad-hoc overloading

-- 
Best regards,
 Bulat                            mailto:[EMAIL PROTECTED]

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to