[m-dev.] Re: For review: changes to graph.m

Fergus Henderson fjh at cs.mu.oz.au
Thu Jun 5 12:37:45 AEST 1997


Peter Schachte, you wrote:
> 
> On Wed, 4 Jun 1997, Fergus Henderson wrote:
> 
> > I think you can have code such as
> > 
> > 	let
> > 		map0 = map_init
> > 		map1 = map_insert map0 "foo" 42
> > 	in 
> > 		..
> > 	
> > and I think then Gofer's type inference will figure out which instance
> > declaration to use based on which type-classes String is an instance
> > of.

Actually that's not correct.  Given a type, it will figure out which
instance declaration to use, but in this example it has to figure out
the type from the instance declarations, and it won't do that.
(This is sensible, given how type classes work: in general, the
different types might have different semantics, not just different
efficiency, and so it shouldn't guess for you...)

[BTW, source code for this example is in ~fjh/src/gofer/overlap_inst.hs.]

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list