Debugging F# code and functional style

Posted by Roger Alsing on Stack Overflow See other posts from Stack Overflow or by Roger Alsing
Published on 2010-04-23T07:33:25Z Indexed on 2010/04/23 7:53 UTC
Read the original article Hit count: 296

I'm new to funcctional programming and have some questions regarding coding style and debugging.

I'm under the impression that one should avoid storing results from funcction calls in a temp variable and then return that variable

e.g.

let someFunc foo =
    let result = match foo with
                 | x -> ...
                 | y -> ...
    result 

And instead do it like this (I might be way off?):

let someFunc foo =
    match foo with
    | x -> ...
    | y -> ...

Which works fine from a functionallity perspective, but it makes it way harder to debug. I have no way to examine the result if the right hand side of -> does some funky stuff.

So how should I deal with this kind of scenarios?

© Stack Overflow or respective owner

Related posts about F#

Related posts about debugging