Posts

Showing posts from August, 2011

F# and the immediate window

(This post is inspired from t his Stack Overflow question ) F# debugger integration is quite good, except for the immediate window. The immediate window requires C# style syntax, so calling F# functions is not intuitive. Below are recipes for the immediate window integrated into a console application. As always code can be found here : // Learn how to use the immediate window for F#. module Program= // To build, add a reference to Microsoft.CSharp. This is required for dynamic support in // the debugger. let allowDynamicToWorkFromImmediateWindowByLoadingCSharpBinders = Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags.BinaryOperationLogical let plusOne = (+)1 let xPlusOnes = [1;2;3] |> Seq.map plusOne [ ] let main (args) = printfn "Try the following in the immediate window: // plusOne 4 ((dynamic)plusOne).Invoke(4) // Seq.Head xPlusOnes Microsoft.FSharp.Collections.SeqModule.Head(xPlusOnes) // let xPlusTwos= xP