[Haskell-cafe] Re: [Haskell] pros and cons of static typing and side effects ?

Bernard Pope bjpop at cs.mu.OZ.AU
Fri Aug 12 02:26:33 EDT 2005

[Moved to the Haskell cafe]

It's Friday afternoon here so I thought I'd join in the fun.

On Thu, 2005-08-11 at 23:01 -0400, ajb at spamcop.net wrote:

> While you can't be certain that once your code typechecks, it's bug-free
> (though that does often happen), you can be almost guaranteed that if
> your code typechecks after a refactoring, the refactoring didn't
> introduce any bugs.  

(I tend to agree with ajb's sentiment, but I'll play the devil's
advocate anyway). Perhaps we can reach a fixed point of violent

I'm a bit concerned with "can't be certain" on the one hand, and
"_almost_ guaranteed", on the other. 

I guess there are nuances to be explored here, and it is all about
degree of confidence.

Sometimes I have high confidence in my refactoring, like introducing a
state monad. Other times I have much less confidence, like swapping the
order of arguments in numerical calculations.

However, if it weren't for static type checking then I would be much
less game to even _try_ introducing a state monad in my code in the
first place. (Maybe that's just me). Another colleague of mine gave the
opinion that one of the reasons higher-order code is less common in
Prolog than Haskell is that in Prolog does not have static type checking
(it's just one factor out of many). It seems to me like static type
checking has the capacity to make some refactorings much less heroic
than they would be in the non-static setting.

That's my "log on the fire" for today.


More information about the Haskell-Cafe mailing list