dotnet / dotnet/fsharp

op_Implicit doesn't work with the pipe operator

Open
#18,160 1 comment 0 reactions 0 assignees View on GitHub
Area-Compiler-Checking-Overloads Feature Request
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

![Image](https://github.com/user-attachments/assets/0ebbf064-35ab-47dd-9200-600aea1aa8f0)

````
type CompilerHelper =
{
// Define the properties of CompilerHelper
Name: string
Code: string
}

// Define the implicit conversion operator
static member op_Implicit(helper: CompilerHelper) : CompilationUnit =
{
UnitName = helper.Name
SourceCode = helper.Code
}

and CompilationUnit =
{
// Define the properties of CompilationUnit
UnitName: string
SourceCode: string
}

// Example usage

let verifyCompilation (compilation: CompilationUnit) = printfn "${compilation}"

let helper = { Name = "Example"; Code = "let x = 42" }
let b = verifyCompilation helper
let c = helper |> verifyCompletion
````

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.