[Haskell-cafe] Re: exceptions vs. Either
Alastair Reid
alastair at reid-consulting-uk.ltd.uk
Thu Aug 5 07:24:48 EDT 2004
> I have a hard time understanding why functional programmers
> would not want more static typing guarantees, after all they
> can always use C if they dont like type systems!
I think the value of Haskell's type system is that it catches a lot of bugs
_cheaply_. That is, with little programmer effort to write the type
annotations, little effort to understand them and little effort to maintain
them as the program evolves.
In general, as we try to express more and more in the type system, the costs
go up so the goal in using a different programming style or extending the
type system is to catch more bugs without significantly increasing the cost.
At an extreme, we could probably use some variant of higher order predicate
calculus as our type system and specify that a sort function (say) returns an
ordered list but the programmer effort in doing so would probably be quite
high.
Using Maybe and the like to catch more errors with the type system isn't as
expensive as using full-on specification and is often the right thing to do
but, in some cases, the benefits of programming that way don't justify the
effort required whereas the techniques suggested for reporting the location
of the problem are cheap and effective.
--
Alastair Reid
More information about the Haskell-Cafe
mailing list