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

Daniel Fischer daniel.is.fischer at web.de
Fri Feb 13 15:57:05 EST 2009


Am Freitag, 13. Februar 2009 21:08 schrieb Jonathan Cast:
> On Fri, 2009-02-13 at 12:15 -0700, John A. De Goes wrote:
> > On Feb 13, 2009, at 12:07 PM, Jonathan Cast wrote:
> > > Exactly!  But if it fails, why on earth should any other use of map in
> > > the module succeed?
> >
> > Because more information is known about other usages of map. Such is
> > the nature of type inference.
>
> No it's not.  Type inference -- in Haskell --- means --- by definition!
> --- looking up the principle type of each sub-term, specializing it
> based on its use, and then generalizing to find the principle type of
> the overall term.  Adding information can cause type inference to fail,
> but --- in Haskell as it exists --- it cannot cause type inference to
> succeed.

I'm not sure about the finer distinctions between type inference and type 
checking as performed by Haskell implementations when compiling a module, but 
what about polymorphic recursion, where adding information via a type 
signature can be necessary to make the compilation succeed?

Not what this thread is about, though.

>  Which is good!

Why is it good?
Because using additional information to make type inference succeed would 
cause an ad hoc and hard to reason about type inference algorithm?
Or other reasons?

>
> jcc
>
Cheers,
Daniel



More information about the Haskell-Cafe mailing list