fsprojects / fsprojects/FSharpPlus

Slow compiler performance in Monad Transformers sample with Visual Studio, and can't give hints.

Open
#24 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement F# Compiler Bug
Dominant language
F#
Stars
941
Forks
106
PR merge metrics
No merged PRs in 30d

Description

When I try Monad Tranformers sample with Visual Studio 2015 along with F# PowerTools, I noticed that the CPU peaks when IDE sits idle, probably due to type inference engine and syntax colorization is delayed for few seconds.

I am not sure if this issue is related to F# compiler , VisualFSharp or FSharpPlus. Can you suggest me any workarounds like putting a hint to make IDE happy for better performance ?
Also when I explicitly give type like below:

let getValidPassword : ErrorT<Async<_>> =
monad {
    let! s = liftAsync getLine
    if isValid s then return s
    else return! throw -1
}
</ catch /> (fun s -> throw ("The error was: " + decodeError s))

Notice Error<Async<_>>

`I get errors like below :

  • Could not resolve the ambiguity inherent in the use of the operator 'Bind' at or near this program point. Consider using type annotations to resolve the ambiguity.
  • Could not resolve the ambiguity inherent in the use of the operator 'LiftAsync' at or near this program point. Consider using type annotations to resolve the ambiguity.
  • Type constraint mismatch when applying the default type 'obj' for a type inference variable. No overloads match for method 'LiftAsync'. The available overloads are shown below (or in the Error List window). Consider adding further type constraints

Why is that so ?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with FSharpPlus/Samples/MonadTransformers.fsx and reproduce the behavior in Visual Studio 2015 with F# PowerTools. Compare the type-inference and syntax-colorization delays with and without the shown type annotation, then determine whether the cause belongs to the F# compiler, VisualFSharp, or FSharpPlus. Done means a confirmed diagnosis and a documented workaround or routing decision.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
compilers, developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.