Functional programming
Rustom Mody
rustompmody at gmail.com
Tue Mar 4 00:59:03 EST 2014
On Tuesday, March 4, 2014 11:05:24 AM UTC+5:30, Steven D'Aprano wrote:
> On Tue, 04 Mar 2014 05:37:27 +1100, Chris Angelico wrote:
> > It's not possible to
> > sub-specify a type (like the "string('a'..'x')" type in Pike that will
> > take only strings with nothing but the first 24 lower-case letters - not
> > that I've ever needed that), but the compiler can work out everything
> > else.
> I have not used Haskell enough to tell you whether you can specify
> subtypes. I know that, at least for numeric (integer) types, venerable
> old Pascal allows you to define subtypes based on integer ranges, so I'd
> be surprised if you couldn't do the same thing in Haskell.
Its a bit murkier. See
http://lambda-the-ultimate.org/node/4771
Especially see the scala choices comment
Also this comment by Peyton Jones is telling
Damas-Milner* is on a cusp:
Can infer most-general types without any type annotations at all
But virtually any extension destroys this property
from www.cs.nott.ac.uk/~gmh/appsem-slides/peytonjones.ppt
* The functional programming type inference algorithm
More information about the Python-list
mailing list