[Haskell-cafe] resolving missing class instances @ compile time

Bulat Ziganshin bulatz at HotPOP.com
Fri May 13 05:24:43 EDT 2005

Hello Greg,

Friday, May 13, 2005, 12:47:54 AM, you wrote:

GB> Samuel Bronson wrote:
>> After thinking about it for a while, I'm positive it would be a LOT of
>> work to get that to work in general, if it is even possible. Even
>> getting it to work in only specific, limited cases (such as within a
>> module) would probably not be easy, since it is such an indirect kind
>> of thing. It probably wouldn't be all that usefull anyway, either.

GB>     (This is my last time, I promise).  Why?  Here's my thought process.
GB> Let's say I a have a program like...

GB>     main = print $ (foo 42)

GB> ...(that's the whole thing).  The compiler parses it, determines that
GB> "foo" is a function being applied to "42" and tries to look up "foo" in
GB> the symbol table.  That fails because there is no function "foo".  Why
GB> is it any different if foo is part of some type class?  We must know
GB> where to look for "foo" since we know the type of "foo" from its
GB> arguments and return value (it passed the type checker after all).

because compiler can't determine logic of your program. and your
program may use some class methods only for some of types for which
this class is defined 

Best regards,
 Bulat                            mailto:bulatz at HotPOP.com

More information about the Haskell-Cafe mailing list