fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

function-keyword debug improvements

Open Thorium opened this issue 2 years ago • 1 comments

@vzarytovskii pointed out that FSharp core team cannot use function keyword:

let myFun = 
   function 
   | Some x -> x 
   | None -> "nothing"

...but instead always write explicit match:

let myFun = fun itm -> 
   match itm with 
   | Some x -> x 
   | None -> "nothing"

...because easier debugging.

My suggestion would be following improvements:

  • when you hover over "function"-keyword at debug-time, it should display the omitted parameter value as tooltip.
  • you should be able to attach a debug-point to function keyword itself (if not working already).

Thorium avatar Nov 20 '23 10:11 Thorium

More generally, one could argue that it would be nice to have a debug point at every pattern-matching location, so that the pattern input could always be inspected even if it was not already bound to a name in scope.

I suspect that that might be a more invasive change to the compiler, though.

brianrourkeboll avatar Nov 20 '23 13:11 brianrourkeboll