[Haskell-cafe] a bunch of newbie questions

Mark T.B. Carroll mark at ixod.org
Fri Aug 4 07:03:54 EDT 2006


Janis Voigtlaender <voigt at tcs.inf.tu-dresden.de> writes:
(snip)
> Yes, as long as enough type information is provided for the
> typechecker to decide what is the correct instance to use.
(snip)

I've always been a little surprised when this doesn't happen more widely
for things other than instances. For instance, when IntMap.size,
Map.size and Set.size (or whatever) are all in scope as "size", it
should be fairly obvious what (size x) is about once we've inferred, for
other reasons, that x is an IntMap. Similarly with records, if we had
field names that cause functions for extracting the value of those
fields, where we used the same field name in two different record types,
I figure that there's usually no ambiguity because we can usually infer
the type of the object to which the 'extractor' is being applied.

Am I just not seeing the big picture, or would people not find this use
of type information to resolve such ambiguities as nice as I would, or
is it harder to do that than I'm expecting?

-- Mark



More information about the Haskell-Cafe mailing list