F# Language

This User Voice was for suggestions about the future evolution of the F# Language and Core Library.

I suggest we ...

You've used all your votes and won't be able to post a new idea, but you can still search and comment on existing ideas.

There are two ways to get more votes:

  • When an admin closes an idea you've voted on, you'll get your votes back from that idea.
  • You can remove your votes from an open idea you support.
  • To see ideas you have already voted on, select the "My feedback" filter and select "My open ideas".
(thinking…)

Enter your idea and we'll search to see if someone has already suggested it.

If a similar idea already exists, you can support and comment on it.

If it doesn't exist, you can post your idea so others can support it.

Enter your idea and we'll search to see if someone has already suggested it.

  1. Remove warning for new keyword on IDisposable

    The only time I ever use the new keyword is on Disposables, and even then only to silence the compiler warnings. I'm not sure what purpose the warning serves either, because you can still forget to bind the disposable with the use keyword instead of with let. What's more annoying is that it prevents you from effective pipelining.

    Could this be removed from the next F# release, or perhaps replaced with a warning if you bind a Disposable with let instead of use?

    5 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    6 comments  ·  Flag idea as inappropriate…  ·  Admin →
  2. Return untyped syntax tree from ITypeProvider

    Add the ability to *opt in* to send back an untyped syntax tree from ITypeProviders. The current type provider mechanism is good for simple data exploration use cases, but otherwise extremely limited, and will soon allow for less metaprogramming than Roslyn in some ways. Currently, some types of type providers not possible to create, because unbound generics, records, discriminated unions, and other normal language features are not supported.

    With the ability to opt in to just returning an untyped syntax tree, it would enable the creation of just about any type provider. It would also effectively give F# macros, though…

    27 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    3 comments  ·  Flag idea as inappropriate…  ·  Admin →
  3. Multi-case unions compiled to struct

    I am posting this idea to be able to track its status since it is already informally under consideration. Tuples, records, and single-cases unions are have already planned (implementation even nearing completoin) to be compilable to a struct:

    struct tuples: https://fslang.uservoice.com/forums/245727-f-language/suggestions/6148669-add-support-for-structtuple
    struct records: https://fslang.uservoice.com/forums/245727-f-language/suggestions/6547517-record-types-can-be-marked-with-the-struct-attribu
    struct single-case unions: https://fslang.uservoice.com/forums/245727-f-language/suggestions/6147144-allow-single-case-unions-to-be-compiled-as-structs

    There is also already a proof of concept for unions of "blittable" types: https://fslang.uservoice.com/forums/245727-f-language/suggestions/7072844-utilise-clr-union-types-for-discriminated-unions

    There has also been a lot of discussion on the implementation of multi-case unions in the discussion of struct records: https://github.com/Microsoft/visualfsharp/pull/620

    One great use of multi-case unions compiled to struct would be optional computations (e.g. Option<'T>) for value…

    20 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    0 comments  ·  Flag idea as inappropriate…  ·  Admin →
  4. Nominal subtyping of unions

    This is basically a repost of "subtyping for discriminated unions" (https://fslang.uservoice.com/forums/245727-f-language/suggestions/6672490-subtyping-for-discriminated-unions), but with more details and a description of a concrete use case.

    I am reposting because I would like more discussion on this and because I think that declined requests are no longer tracked by Don Syme (and others).

    Don Syme declined the feature because he likes features to be generic and symmetric for types in F#. This is a good general rule and I trust in Don's good taste, but I think that this feature request is an exception to the rule, so the decline should…

    8 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    0 comments  ·  Flag idea as inappropriate…  ·  Admin →
  5. Support constant values in Discriminated unions

    Hi,

    While trying to model a music domain I ended up with this code:

    type Note = | C | CSharp | DFlat | D | DSharp | EFlat | E | F | FSharp
    | GFlat | G | GSharp | AFlat | A | ASharp | BFlat | B

    let noteName note =
    match note with
    | C -> "C" | CSharp -> "C#" | DFlat -> "Db" | D -> "D"
    | DSharp -> "D#" | EFlat -> "Eb" | E -> "E" | F -> "F"
    | FSharp -> "F#" | GFlat -> "Gb" | G…

    6 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    3 comments  ·  Flag idea as inappropriate…  ·  Admin →
  6. Support mixed F# and C# projects in order to extend F# usage

    Support mixing F# and C# source files in the same project in order to support a gradual move to F# for new users/organisations and to support cases where tooling is oriented at C# (F# not supported)

    For instance I could use this feature to slowly move a C# project to F# one class at the time. Another example would be to use C# tooling to generate web infrastructure like ASP.NET 5 controllers (because F# does not currently have templates for this) and then call directly into F# from those.

    P.S. Other languages that F# compares to like Scala already supported…

    121 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    6 comments  ·  Flag idea as inappropriate…  ·  Admin →
  7. kprintf with delayed string construction

    Currently kprintf and friends take in a continuation function and a StringFormat and return a curried function that when applied builds the string.

    It would be nice for logging frameworks to have an overload where the continuation does not build the string rather provides a delayed function to build the string.

    That way I can do something like:
    let public logWithFormat logLevel logFormat =
    kprintf (fun stringBuilder -> if logLevel > currentLoggingLevel then sprintf "%s" (stringBuilder())) logFormat

    10 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    2 comments  ·  Flag idea as inappropriate…  ·  Admin →
  8. Provide property on base Discriminated Union type if all the case constructors have the same paramater

    If an each case constructor of Discriminated Union has a parameter with the same name and the same type than allow to implement a property on Discriminated Union base type to access to this parameter value.

    Now I have to write a match on every case

    type Physical =
    | OneToOne of Data : ModuleData * Line : ModuleList
    | OneOnOne of Data : ModuleData * Line1 : ModuleList * Line2 : ModuleList
    | OneByOne of Data : ModuleData * Line1 : ModuleList * Line2 : ModuleList
    | Vertical of Data : ModuleData * Line1 : ModuleList * Line2 :…

    27 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    2 comments  ·  Flag idea as inappropriate…  ·  Admin →
  9. Support for TypeProvider nested types with static parameters

    Please support TypeProviders providing nested types with static parameters. This would be valuable for metaprogramming similar to how static parameterized method support is valuable compared to the language without them. It would allow a fluent-like construction of types and partially make up for the non-variable length static parameters on a single type. See https://github.com/fsharp/FSharpLangDesign/issues/88

    10 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    0 comments  ·  Flag idea as inappropriate…  ·  Admin →
  10. Add many more string manipulation functions to the Core.String module

    The Core.String module does not provide nearly enough features at present, too often we have to revert to using the the standard .NET string class which both hinders tidy piping and stops us taking advantage of curried args / partial application.

    I suggest that at least the following functions be added to the string module:

    empty : string
    isEmpty : string -> bool
    isWhitespace : string -> bool
    replace : string -> string -> string -> string
    startsWith/endsWith : string -> bool
    split : seq<char> -> string -> seq<string>
    toUpper/toLower(Invariant) : string -> string
    trim : string -> string
    trimStart/trimEnd…

    53 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    4 comments  ·  Flag idea as inappropriate…  ·  Admin →
  11. Make module function callable as class extension method

    Sometimes it's more convenient and succint to call a function using dot-notation (i.e., class method) than calling module functions with pipeline, yet module function is easier to be composed. I propose the compiler automatically generate class extension methods from module functions, based on a new attribute "CallByInstance" Example:

    namespace Namespace

    // .fsi
    module List =
    val map: ('T -> 'U) -> [<CallByInstance>] list<'T> -> list<'U>

    Compiler will automatically generate an extension method of list<'U>, in the *containing* namespace, i.e.,

    namespace Namespace

    module List = ...

    // Automatically generated:
    [<AutoOpen>]
    module ListExtension_map =
    type List<'U> with
    member this.map f list =…

    10 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    5 comments  ·  Flag idea as inappropriate…  ·  Admin →
  12. Support for named curried functions

    The idea here is to add support for labeled arguments in curried functions. This could allow to extend things like partial application to depend not only on arguments order, and also to introduce default argument values in curried functions (now it's possible only in F# type methods).

    This feature is supported already in ML languages like OCaml or FB Reason.

    24 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    3 comments  ·  Flag idea as inappropriate…  ·  Admin →
  13. Support type annotation based on expression's type

    It would be helpful to have type annotation made of the type of another expression:

    let a = 1
    let b : typeofexpr<a> = 2

    this type of type annotation exists in Oracle SQL database (tablename.column_name%type) and is implemented in jai language:

    https://www.youtube.com/watch?v=iVN3LLf4wMg

    I believe it is also possible to do similar thing with C++ templates.

    1 vote
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    0 comments  ·  Flag idea as inappropriate…  ·  Admin →
  14. Seq.transpose

    It would be nice to have a function that transposes sequences:
    [ [ 00; 01; 02;... ]; [ 10; 11; 12;... ]; [ 20; 21; 22;... ];... ]
    to
    [ [ 00; 10; 20;... ]; [ 01; 11; 21;... ]; [02; 12; 22;... ];... ]

    This is particularly useful when dealing with infinite x infinite sequences, where you want to iterate over the 'outer group' first.

    14 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    2 comments  ·  Flag idea as inappropriate…  ·  Admin →
  15. Add empty value into the String module

    Copied from this GitHub issue: https://github.com/Microsoft/visualfsharp/issues/1139

    Right now, if I do not want to use the empty string literal "", I have to do something like

    printfn "%s" System.String.Empty

    in order to reference the public static readonly instance of the empty string in the BCL.

    It would be more convenient if I can just do:

    // Referencing the F# String module here instead of System.String
    printfn "%s" String.empty

    I would imagine String.empty to be an alias to System.String.Empty so there should be just a one-line code change:

    module String =

    [<CompiledName("Empty")>]
    let empty = ""

    // Other String functions
    I…

    1 vote
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    1 comment  ·  Flag idea as inappropriate…  ·  Admin →
  16. Allow [<DefaultValue>] on member val auto-properties

    This is specifically motivated by my issues with using Entity Framework and how it initializes DbSet<'T> elements. There might be other applications.

    In order to correctly interact with EF in C# I may use:
    public DbSet<RecType> Records { get; set }

    To accomplish the same thing in F# I must;
    [<DefaultValue>]
    let mutable private _Records: DbSet<RecType>
    member x.Records with get() = x._Records and set value = x._Records <- value

    Not doing so causes the EF wire-ups to be lost when the regular member init-assign is called.

    I believe that it would be beneficial to allow the following:
    [<DefaultValue>]
    member val…

    6 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    4 comments  ·  Flag idea as inappropriate…  ·  Admin →
  17. Add more split functions to List, Seq, and other collection modules

    Haskell has this Data.List.Split (https://hackage.haskell.org/package/split-0.1.1/docs/Data-List-Split.html) library which supports multiple strategies for list splitting. I think those functions can come in handy in some scenarios, plus they cannot be easily made by chaining other existing functions, therefore should be included in the core library?

    3 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    0 comments  ·  Flag idea as inappropriate…  ·  Admin →
  18. Update records to allow embeddable records

    Update the sytax of records to allow the following:
    type Position = {X : int; Y : int}
    type Sprite = {
    Position
    Name : string
    Image : array byte }

    Which would result in the Position records fields being embedded into Sprite.

    The Go language has such a feature which works quite nicely:
    https://golang.org/ref/spec#Struct_types

    22 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    3 comments  ·  Flag idea as inappropriate…  ·  Admin →
  19. Enable to use open in other scopes

    It would be nice to be able to use open in function scope and maybe other places where it currently is illegal.

    26 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    8 comments  ·  Flag idea as inappropriate…  ·  Admin →
  20. Optionally specify file order by a fileorder.fsx (or fileorder.txt or fileorder.json) file

    With F# becoming more and more multi-editor and cross-platform, it is becoming increasingly difficult to teach all build/edit tools about F#'s file order. The F# community are currently struggling to "update" each new build/edit tool to understand that F# actually needs a file order.

    Part of the problem is that there is no standard textual way to specify this file order except as command line arguments, and these are not stored in an editable form. There is no standard way to specify the F# file order. We need an (optional) solution to this problem that is closer to home and…

    20 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    4 comments  ·  Flag idea as inappropriate…  ·  Admin →

F# Language

Feedback and Knowledge Base