FSharpPlus icon indicating copy to clipboard operation
FSharpPlus copied to clipboard

error FS0073: internal error: Undefined or unsolved type variable: ^_?82069

Open gusty opened this issue 5 years ago • 1 comments

This is a problem we find from time to time.

@NickDarvey just posted a small repro in our Slack (thanks Nick) so I'm creating this issue on his behalf and also to track it, since this issue has been already identified in the compiler and a fix exists.

#r @"c:\Users\gus\.nuget\packages\fsharpplus\1.1.1\lib\net45\FSharpPlus.dll"
open FSharpPlus
open FSharpPlus.Data

module Repro =
    type Customer = { Name : string }
    type Remote<'Value> = ResultT<Result<'Value, string> option>
    let appendCustomerResponse (existing : Customer NonEmptyList Remote) (next : Customer Remote) =
        lift2 NonEmptyList.cons next existing

This fails with the above error, which is clearly an FSharp Compiler error (that's normally the case when it's internal error).

It seems to me that @dsyme already solved that issue in the branch for RFC1043 but unfortunately doesn't seem to be happy to bring it to master as an independent fix, which to me clearly is as I've been experiencing it since ages.

Here's a link to the discussion, and his repsonse.

https://github.com/dotnet/fsharp/pull/6805#issuecomment-601866624

@dsyme I hope you reconsider it, I mean, if RFC1043 is gonna make it into F#5 I'm fine but I'm not sure that will be the case..

gusty avatar Jul 05 '20 17:07 gusty

Here's a run of the repro, using the feature/ext branch of the compiler (no preview switch)

> #r @"c:\Users\gus\.nuget\packages\fsharpplus\1.1.1\lib\net45\FSharpPlus.dll" ;;

--> Referenced 'c:\Users\gmpl2\.nuget\packages\fsharpplus\1.1.1\lib\net45\FSharpPlus.dll' (file may be locked by F# Interactive process)

> #r @"c:\Repos\FSharpPlus\src\FSharpPlus\bin\Release\net45\FSharpPlus.dll"
-
- open FSharpPlus
- open FSharpPlus.Data
-
- module Repro =
-     type Customer = { Name : string }
-     type Remote<'Value> = ResultT<Result<'Value, string> option>
-     let appendCustomerResponse (existing : Customer NonEmptyList Remote) (next : Customer Remote) =
-         lift2 NonEmptyList.cons next existing
- ;;

--> Referenced 'c:\Users\gus\.nuget\packages\fsharpplus\1.1.1\lib\net45\FSharpPlus.dll' (file may be locked by F# Interactive process)

module Repro = begin
  type Customer =
    { Name: string }
  [<Struct>]
  type Remote<'Value> = FSharpPlus.Data.ResultT<Result<'Value,string> option>
  val appendCustomerResponse :
    existing:Remote<FSharpPlus.Data.NonEmptyList<Customer>> ->
      next:Remote<Customer> ->
        FSharpPlus.Data.ResultT<Result<FSharpPlus.Data.NonEmptyList<Customer>,
                                       string> option>
end

As you can see, it works as expected, without any issue.

gusty avatar Jul 05 '20 17:07 gusty