I suggest we ...

Improve the query { ... } -syntax

Three ideas of the new query{ ... } -syntax:

1) Do something for the amount of white space needed for new line as the arrow "->" can't break the line!
As the tutorial shows, there is like one word per line:

2) Improve the syntax: Now it is weird and have more noise than SQL or LINQ. So I even rather use LINQ-to-IQueryable in F# than F#'s own query-syntax. This can be done By making as simple query {...} as possible and then use Linq-library to manipulate it further.

3) Make it compile-time-aware of capacities of the queryed interface. For example, Azure Table Storage won't support most of the queries:

12 votes
Sign in
Sign in with: Facebook Google
Signed in as (Sign out)
You have left! (?) (thinking…)
Tuomas Hietanen shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Sign in with: Facebook Google
Signed in as (Sign out)
  • Don Syme commented  ·   ·  Flag as inappropriate

    My feeling is that the solution to these problems is not in modifications to the "query" feature but in taking alternative approaches to querying. For example:

    The Azure Storage Type Provider shows a better way to have queries when the query language is limited: http://fsprojects.github.io/AzureStorageTypeProvider/

    The SqlCommandProvider shows how to do checked SQL directly using type providers: http://fsprojects.github.io/FSharp.Data.SqlClient/

  • Loic Denuziere commented  ·   ·  Flag as inappropriate

    1) you can perfectly break the line before or after "->". In the linked example this works just fine:

    Chart.Point([for cy in cyclonesWithFatalities ->
    cy.``Highest winds``.Value,
    cy.``Total fatalities``.Value])

    (in case the whitespace gets mangled: the "cy..." lines are indented further than the start of "for")

    2) Do you have concrete examples?

    3) I agree with this one, it would be nice.

F# Language

Feedback and Knowledge Base