Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update of FSharp.Core and language to F# v6 ? #405

Open
Thorium opened this issue Jun 27, 2024 · 1 comment
Open

Update of FSharp.Core and language to F# v6 ? #405

Thorium opened this issue Jun 27, 2024 · 1 comment

Comments

@Thorium
Copy link
Member

Thorium commented Jun 27, 2024

Would it be possible to update the current FSharp.Core 4.7.1 to 6.0.1, and update F# language version to 6.0 ?

Or is there still really justification to support F# core 4.7.1 ?
This is nothing to do with .NET Framework support, which I still would like to keep as is: .Net Standard 2.0 and .Net Standard 2.1.

I was testing the performance, and seems the CodeGenerator is bit slow,
and making the current active patterns to Structs would actually help quite a bit:

let makeTypePattern tp =

        let makeTypePattern tp = 
            let tt = convTypeToTgt tp
            fun (t : Type) -> if t = tt then ValueSome() else ValueNone

        [<return: Struct>]
        let (|Bool|_|) = makeTypePattern(typeof<bool>)
        [<return: Struct>]
        let (|SByte|_|) = makeTypePattern(typeof<sbyte>)
        [<return: Struct>]
        let (|Int16|_|) = makeTypePattern(typeof<int16>)
        [<return: Struct>]
        let (|Int32|_|) = makeTypePattern(typeof<int32>)
        [<return: Struct>]
        let (|Int64|_|) = makeTypePattern(typeof<int64>)
        [<return: Struct>]
        let (|Byte|_|) = makeTypePattern(typeof<byte>)
        [<return: Struct>]
        let (|UInt16|_|) = makeTypePattern(typeof<uint16>)
        [<return: Struct>]
        let (|UInt32|_|) = makeTypePattern(typeof<uint32>)
        [<return: Struct>]
        let (|UInt64|_|) = makeTypePattern(typeof<uint64>)
        [<return: Struct>]
        let (|Single|_|) = makeTypePattern(typeof<single>)
        [<return: Struct>]
        let (|Double|_|) = makeTypePattern(typeof<double>)
        [<return: Struct>]
        let (|Char|_|) = makeTypePattern(typeof<char>)
        [<return: Struct>]
        let (|Decimal|_|) = makeTypePattern(typeof<decimal>)
        [<return: Struct>]
        let (|String|_|) = makeTypePattern(typeof<string>)

//... and (|NaN|_|) and (|NaNSingle|_|) could also be struct-tuples

The other option would be adding more compiler directives, because most of the F# TypeProviders refer this still as external file and not Nuget-package. So would you rather accept something like #if FSHARP6 code-block PR?

@Thorium
Copy link
Member Author

Thorium commented Jul 5, 2024

There are some code not needed in ProvidedTypes.fs if F# 6 would be used, for example:

These are in F# core now:

let isNull x = match x with null -> true | _ -> false

type StructOption<'T> (hasValue: bool, value: 'T) =

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant