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

Greg Buchholz haskell at sleepingsquirrel.org
Thu May 12 16:47:54 EDT 2005


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.

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

    main = print $ (foo 42)

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

Confused,

Greg Buchholz


More information about the Haskell-Cafe mailing list