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?
To inspect the middle of a pipeline, I suggest the following workaround:
Put this code at some place:
[<AutoOpen>] module AutoOpenModule #if DEBUG let (|>) value func = let result = func value result #endif
Enable "Step Into Properties and Operators in Managed Code":
https://msdn.microsoft.com/en-us/library/cc667388(v=vs.100).aspx
Now you should be able to step into the pipeline operator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With