[Haskell-cafe] Re: Overloading functions based on arguments?

Jonathan Cast jonathanccast at fastmail.fm
Fri Feb 13 13:49:22 EST 2009

On Fri, 2009-02-13 at 11:45 -0700, John A. De Goes wrote:
> On Feb 13, 2009, at 11:32 AM, Jonathan Cast wrote:
> > I believe the last time it was brought up, the proposal was that type
> > inference should fail on certain typeable terms.  That doesn't count.
> I'm referring to a rather conservative proposal wherein if there is  
> one and exactly one definition that allows an expression to type, then  
> name overloading in the same scope is permitted.
> Aside from exponential performance in pathological (but unlikely)  
> cases, what issue do you have with such a proposal?

It breaks type inference.  I explained this at the time.  I can explain
it again:

  import Data.List
  import Data.Set
  import Data.Map

  warmFuzzyThingFirstOperation = map

This gives an error currently.  Quite properly.  But if *any* use of
`map' type-checks, with those imports, why on earth should this one
fail?  You don't want to remove a wart from the language, you want to
introduce one!


More information about the Haskell-Cafe mailing list