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

Jonathan Cast jonathanccast at fastmail.fm
Fri Feb 13 14:06:06 EST 2009


On Fri, 2009-02-13 at 20:06 +0100, Daniel Fischer wrote:
> Am Freitag, 13. Februar 2009 19:49 schrieb Jonathan Cast:
> > 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
> 
> To do justice to the above proposal, in that situation more than one choice 
> would typecheck (were the other imports absent or qualified), so that should 
> also be rejected according to it.

Yeah, my objection is precisely that this trivial example is rejected.
If this use of map is rejected, then I claim *every* use of map should
be rejected.

jcc




More information about the Haskell-Cafe mailing list