[Haskell-cafe] Re: Debugging partial functions by the rules

Neil Mitchell ndmitchell at gmail.com
Wed Nov 15 09:55:47 EST 2006


Haskell is great for equational reasoning.

> blah the_v_in_scope blah
> where (the_v_in_scope:_) =  [ v | (n,v) <- env, n==target ]

This piece of code isn't. If you used head then you could trivially
inline the_v_in_scope, this way is a lot harder. You might spot a
pointfree pattern and lift it up. You might move code around more
freely. Lots of patterns like this breaks the equational reasoning in
the style that most people are used to.

> and it doesn't seem /that/ great an
> imposition.

I disagree, this is a massive imposition, and requires lots of
refactoring, and is just a little bit ugly. What to go in a where
should be the programmers decision, not the decision based on which
hoops one has to hop through to write a debuggable Haskell program.



More information about the Haskell-Cafe mailing list