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. Modify open so that it can explicitly only open certain parts

    e.g. open System.Reflection (Assembly)

    13 votes
    Vote
    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      You have left! (?) (thinking…)
      3 comments  ·  Flag idea as inappropriate…  ·  Admin →
    • Naming convention improvements

      I don't think the language benefits from the use of abbreviations especially when they are not consistent. For example
      type ResizeArray<'T> = System.Collections.Generic.List<'T>

      I would say that should be named ResizableArray. The current naming sounds like a function. There are more examples of this type of abbreviation that I will try to add when I am reminded of them.

      10 votes
      Vote
      Sign in
      Check!
      (thinking…)
      Reset
      or sign in with
      • facebook
      • google
        Password icon
        Signed in as (Sign out)
        You have left! (?) (thinking…)
        2 comments  ·  Flag idea as inappropriate…  ·  Admin →
      • Revert the access modifier on FSharpFunc<T, TResult> constructor to be protected again.

        It has been changed to public in 4.4, which is a rather odd construct for an abstract class.

        1 vote
        Vote
        Sign in
        Check!
        (thinking…)
        Reset
        or sign in with
        • facebook
        • google
          Password icon
          Signed in as (Sign out)
          You have left! (?) (thinking…)
          1 comment  ·  Flag idea as inappropriate…  ·  Admin →
        • Support Tabs

          Don't force a code style upon users. Tabs can work perfectly well in whitespace-sensitive languages - see python or haskell - and many people prefer them.
          Forcing users to use your style just comes across as petty and picky: not the impression you should be giving. Disappointing to see a promising language hamstrung by narrow-minded design decisions.

          11 votes
          Vote
          Sign in
          Check!
          (thinking…)
          Reset
          or sign in with
          • facebook
          • google
            Password icon
            Signed in as (Sign out)
            You have left! (?) (thinking…)
            9 comments  ·  Flag idea as inappropriate…  ·  Admin →
          • add isNotNull to FSharp.Core

            Using "not (isNull a)" in conditions forces usage of parens or pipe operator and is not optimal readability compared to "a |> isNotNull" or "isNotNull a"

            let inline isNotNull a = not (isNull a)

            in absence of this function, people often take the shortcut of "a <> null" which according to lint is not optimal.

            2 votes
            Vote
            Sign in
            Check!
            (thinking…)
            Reset
            or sign in with
            • facebook
            • google
              Password icon
              Signed in as (Sign out)
              You have left! (?) (thinking…)
              6 comments  ·  Flag idea as inappropriate…  ·  Admin →
            • Add feature to allow string literals to be separated into text files

              Often in code there is a block of meta language in a string format. Typical examples could be SQL, XML, JSON, MD, or just plain text. The choices a developer normally has is either to embed the text as a string literal or to spearate into a file. Separating into a file normally has some advantages in that the format gets better editing support (ex. MyQuery.sql has a nice editing experience than an embedded string) and it cleans up the related code. The down side is traditionally that now the file is read in at runtime and the tooling support…

              8 votes
              Vote
              Sign in
              Check!
              (thinking…)
              Reset
              or sign in with
              • facebook
              • google
                Password icon
                Signed in as (Sign out)
                You have left! (?) (thinking…)
                5 comments  ·  Flag idea as inappropriate…  ·  Admin →
              • support flexible types in type alias

                Ability to define

                type CreateCommand = unit -> #IDbCommand

                instead of

                type CreateCommand<'T when 'T :> IDbCommand> = unit -> 'T

                because the later forces me to specify the generic type (even with _) at places I'm using it.

                I'm not clear if there are cases where it would create issues, but it would be nice to have some explicit ways to tell we are ok with implict polymorphism.

                1 vote
                Vote
                Sign in
                Check!
                (thinking…)
                Reset
                or sign in with
                • facebook
                • google
                  Password icon
                  Signed in as (Sign out)
                  You have left! (?) (thinking…)
                  1 comment  ·  Flag idea as inappropriate…  ·  Admin →
                • Code robustness: Range of admissible values for class fields and record fields (from Ada 2012)

                  I suggest introducing an aspect that can be applied to declarations of classes and record types with the aim of specifying ranges of admissible values for class fields and record fields easily.

                  This suggestion is an extension of my previous suggestion:
                  Code robustness: Types with ranges of admissible values (from Ada 2012)
                  Please see: https://fslang.uservoice.com/forums/245727-f-language/suggestions/12802701-code-robustness-types-with-ranges-of-admissible-v

                  Example # 1: Record type with ranges of admissible values specified for its fields.

                  type Location = {
                  mutable Y: float range –1.0 .. 1.0 = 1.0
                  mutable X: float range -1.0 .. 1.0 = 0.0 // field X is default initialized to 0.0, its…

                  1 vote
                  Vote
                  Sign in
                  Check!
                  (thinking…)
                  Reset
                  or sign in with
                  • facebook
                  • google
                    Password icon
                    Signed in as (Sign out)
                    You have left! (?) (thinking…)
                    declined  ·  0 comments  ·  Flag idea as inappropriate…  ·  Admin →
                  • Compiler-enforced defensive coding: Parentheses to surround the if or match expression within another expression (from Ada 2012)

                    I suggest using the if or match expression immediately surrounded by parentheses (on both sides) so long as it is used as part of another expression:

                    let a = b + (if x then y else z) + c // parentheses required
                    let a = b + (match x with y -> y | _ -> z) + c // parentheses required

                    I think the F# compiler should emit a warning (not an error, so it is not a breaking change in the F# language) so long as the if or match expression is not immediately surrounded by parentheses within…

                    1 vote
                    Vote
                    Sign in
                    Check!
                    (thinking…)
                    Reset
                    or sign in with
                    • facebook
                    • google
                      Password icon
                      Signed in as (Sign out)
                      You have left! (?) (thinking…)
                      1 comment  ·  Flag idea as inappropriate…  ·  Admin →
                    • Use the "not in" keyword combination for membership tests (from Ada 2012)

                      I suggest using the "not in" keyword combination for membership tests (from Ada 2012).

                      Example # 1:
                      if x not in 1 .. 100 then ... // this form of the if expression has better readability than: if x < 1 || x > 100 then..., and you have no need to use the "x" value name twice.

                      Example # 2:
                      match counter with n when n not in 1 .. 10 .. 101 -> ... // the when expression here has a succinct form and better readability than the current syntax: match counter with n when [ 1 ..…

                      1 vote
                      Vote
                      Sign in
                      Check!
                      (thinking…)
                      Reset
                      or sign in with
                      • facebook
                      • google
                        Password icon
                        Signed in as (Sign out)
                        You have left! (?) (thinking…)
                        2 comments  ·  Flag idea as inappropriate…  ·  Admin →
                      • Improve cloning record syntax

                        It would be great and comfortable to write: { Record with field1 = x and field2 = y and field3 = z } instead of {{{ Record with field1 = x } with field2 = y } with field3 = z }.
                        I suggest to make it possible the alternative syntax { ... with ... and ... and ... and so on } for cloning records with multiple fields updated at once, and mark the current syntax {{{{ ... with ... } with ... } with ...} with ... so on } as obsolete in the language specification, but permissible…

                        1 vote
                        Vote
                        Sign in
                        Check!
                        (thinking…)
                        Reset
                        or sign in with
                        • facebook
                        • google
                          Password icon
                          Signed in as (Sign out)
                          You have left! (?) (thinking…)
                          1 comment  ·  Flag idea as inappropriate…  ·  Admin →
                        • add DAG like source reference control feature

                          F# has source reference limitation feature by source order, but it should be enhanced.
                          I think source references should be like DAG.
                          Now upper source code can be referenced by any lower source code, but I wanna control some group can and some not.
                          This may be enough if module has access control feature like C++'s friend against module.
                          This feature increase limitations but eliminates complex source relationship and make easier to grab source structure if it's used properly.

                          3 votes
                          Vote
                          Sign in
                          Check!
                          (thinking…)
                          Reset
                          or sign in with
                          • facebook
                          • google
                            Password icon
                            Signed in as (Sign out)
                            You have left! (?) (thinking…)
                            1 comment  ·  Flag idea as inappropriate…  ·  Admin →
                          • Linker!

                            Heres a controversial idea. It would really help in big projects if the order of files didnt matter, like in most other languages. Not only its way more convenient not having to care, it would also allow for folders in solution explorer which solves the problem of having a 200 .fs files in one folder which could occur in large applications.

                            3 votes
                            Vote
                            Sign in
                            Check!
                            (thinking…)
                            Reset
                            or sign in with
                            • facebook
                            • google
                              Password icon
                              Signed in as (Sign out)
                              You have left! (?) (thinking…)
                              0 comments  ·  Flag idea as inappropriate…  ·  Admin →
                            • Add non-empty collection versions (or a generic nonempty type?) to the core library

                              A class of empty collection bugs and checking code could be eliminated if there was standard library support for non-empty collections.

                              In a similar way to the option type it would make function signatures more explicit.

                              3 votes
                              Vote
                              Sign in
                              Check!
                              (thinking…)
                              Reset
                              or sign in with
                              • facebook
                              • google
                                Password icon
                                Signed in as (Sign out)
                                You have left! (?) (thinking…)
                                1 comment  ·  Flag idea as inappropriate…  ·  Admin →
                              • Pattern matching on member defintions

                                when extending discriminated unions with member implementations we can introduce a fresh name for 'this' (usually this or x). This identifier however is syntactically not a pattern.
                                It would be nice (for irrefutable patterns) to match directly on this position, .e.g.:

                                type Test2 = Test2 of int * int with
                                member (Test(a,b)).Blub() = a + b

                                instead of:
                                type Test = Test of int * int with
                                member x.Blub() = let (Test(a,b)) = x in a + b

                                The benefit seems to be minor, but additionally my proposal improves uniformity of the language.
                                However i fear this introduces ambiguities in…

                                1 vote
                                Vote
                                Sign in
                                Check!
                                (thinking…)
                                Reset
                                or sign in with
                                • facebook
                                • google
                                  Password icon
                                  Signed in as (Sign out)
                                  You have left! (?) (thinking…)
                                  1 comment  ·  Flag idea as inappropriate…  ·  Admin →
                                • Exclude mutable fields from GetHashCode in record types

                                  The current default implementation for GetHashCode on record types includes all fields, including those marked as mutable. While this certainly helps in testing structural equality, this violates the MSDN documentation's recommendations for how to implement the function (seen at https://msdn.microsoft.com/en-us/library/system.object.gethashcode%28v=vs.110%29.aspx under "Notes to Inheritors").

                                  While this is not typically an issue, as records are normally used as immutable data types, it becomes an issue in cases where the hash codes are relied upon. As an example, if a collection of record values is provided as the ItemsSource for a WPF ListView control (even stored in an ObservableCollection<T>), modifying mutable fields…

                                  6 votes
                                  Vote
                                  Sign in
                                  Check!
                                  (thinking…)
                                  Reset
                                  or sign in with
                                  • facebook
                                  • google
                                    Password icon
                                    Signed in as (Sign out)
                                    You have left! (?) (thinking…)
                                    4 comments  ·  Flag idea as inappropriate…  ·  Admin →
                                  • Single-use / inline discriminated unions

                                    I noticed something similar to this in Typescript and it got me thinking - there are occasions when you have a discriminated union that you only want to use as a "one off" e.g.

                                    type WindDirection = N | S | E | W
                                    type Weather = { WindDirection : WindDirection; IsRaining : bool }

                                    Could this be simplified to something like this: -

                                    type Weather = { WindDirection : (N | S | E | W); IsRaining : bool }

                                    Almost like a "nameless DU" - similar in a way to active patterns - which might be useful in…

                                    8 votes
                                    Vote
                                    Sign in
                                    Check!
                                    (thinking…)
                                    Reset
                                    or sign in with
                                    • facebook
                                    • google
                                      Password icon
                                      Signed in as (Sign out)
                                      You have left! (?) (thinking…)
                                      3 comments  ·  Flag idea as inappropriate…  ·  Admin →
                                    • Allow Attributes to follow the `member` keyword

                                      instead of just -

                                      [<DebuggerStepThrough>]
                                      member __.ReturnFrom (value: 'T option) : Async<'T option> = async.Return value

                                      and -

                                      [<DebuggerStepThrough>] member __.ReturnFrom (value: 'T option) : Async<'T option> = async.Return value

                                      ^ which causes indentation issues for following definitions without attributes

                                      allow -

                                      member [<DebuggerStepThrough>] __.Zero () : Async<unit option> = Some () |> async.Return

                                      1 vote
                                      Vote
                                      Sign in
                                      Check!
                                      (thinking…)
                                      Reset
                                      or sign in with
                                      • facebook
                                      • google
                                        Password icon
                                        Signed in as (Sign out)
                                        You have left! (?) (thinking…)
                                        1 comment  ·  Flag idea as inappropriate…  ·  Admin →
                                      • remove Seq.rev from FSharp.Core again

                                        the collection regularization was a good idea. Unfortunately we introduced Seq.rev which internally converts to array. This working for most real-life sequences, but breaks laziness.

                                        I suggest to mark the function as obsolete and remove it later.

                                        See also https://github.com/Microsoft/visualfsharp/issues/902

                                        12 votes
                                        Vote
                                        Sign in
                                        Check!
                                        (thinking…)
                                        Reset
                                        or sign in with
                                        • facebook
                                        • google
                                          Password icon
                                          Signed in as (Sign out)
                                          You have left! (?) (thinking…)
                                          9 comments  ·  Flag idea as inappropriate…  ·  Admin →
                                        • Add filtermap to the standard library

                                          Add filtermap to the standard library

                                          Rust, Elixir and other functional languages have this and it would be nice to have an alternative to the option allocating choose function:

                                          let filtermap (filter:a->bool) (map: a->b) (xs: a list) -> b list = ...

                                          Elixir:http://elixir-lang.org/docs/v1.0/elixir/Enum.html#filter_map/3
                                          Rust: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.filter_map

                                          23 votes
                                          Vote
                                          Sign in
                                          Check!
                                          (thinking…)
                                          Reset
                                          or sign in with
                                          • facebook
                                          • google
                                            Password icon
                                            Signed in as (Sign out)
                                            You have left! (?) (thinking…)
                                            9 comments  ·  Flag idea as inappropriate…  ·  Admin →
                                          ← Previous 1 3 4 5 12 13

                                          F# Language

                                          Feedback and Knowledge Base