17,082 questions
0
votes
1
answer
78
views
translation of f# expression to c# in the debugger
Ionide debugger doesn't support f# now. Such expressions should be translated to c#.
How can I see, say, the following expression:
connections|>List.map(fun c->c.Probabilities)
2
votes
1
answer
68
views
Instantiation of type with recursive type constraints
The Announcing F #7 page gives the example code
type IAddition<'T when 'T :> IAddition<'T>> =
static abstract op_Addition: 'T * 'T -> 'T
type Number<'T when IAddition<'T&...
0
votes
1
answer
54
views
F# * and -> difference
I little bit strugle with understanding when a*b and a->b is casted (not sure if casting is good word) implicitly. Example: (I am not sure, if this is feature or bug)
type a = {
x: int
}
with
...
Advice
2
votes
6
replies
84
views
How to model a deep inheritance in F# and allow all items to be added to an inventory
Referring to the attached diagram for an example hierarchy of materials, how can I represent this in F#? Once represented I need to be able to add ANY/ALL of the materials in level 4 (L4) of the ...
Best practices
2
votes
6
replies
114
views
Short circuit F# fold
Is there a convenient way to short circuit a Seq.fold evaluation?
For example, the following function evaluates if parenthesis are balanced in a string.
let isBalanced str =
(([], str) ||> Seq....
0
votes
0
answers
72
views
Visual Studio 2026 - F# MAUI fails with "DEP1700: The recipe file ..." is missing
I recently installed Visual Studio 2026.
My program is written in F# with MAUI.
With Visual Studio 2022 it was working so far, since I installed VS 2026, it fails on VS 2022 as well. Prior VS 2026 I ...
Best practices
0
votes
6
replies
83
views
Avoiding redundancy using type constraints in F#
I have a Measurement type and a Constant type, like so
type Measurement =
private
{ value: Var
uncertainty: float
unit: Unit }
static let getUncertainty v =
...
0
votes
1
answer
68
views
Defining exponentiation for a custom type
I have a simple record type with float fields that I'm trying to define the exponentiation for, but I keep running into errors one after another.
This was my first attempt:
static member ( ** )(a, ...
3
votes
1
answer
72
views
How does F# record label inference work across projects?
I have an F# solution with the following project structure:
ProjectA
Foo.fs
Bar.Fs
ClientA.fs
ProjectB
ClientB.fs
Where ProjectB depends on ProjectA.
Foo.fs defines a type:
type Foo =
{
...
0
votes
1
answer
63
views
How to add Math text to XPlot.Plotly Plots in F#?
I want to add LaTeX to my plot. I'm using XPlot.Plotly to make plots.
let layout =
Layout(
title = "Plot of $\\frac{1}{t}$ vs h",
xaxis = Xaxis(title = "...
0
votes
1
answer
80
views
How to take exponent of a value with units in F#?
I'm trying to write some physics equations, but I am unable to raise a value with units to some number
This is the part I have a problem with
r.Weight * 9.8<m / s^2> * (o.BarLength ** 3.)
/ (4. *...
0
votes
0
answers
55
views
F# Build Error - ...expression was expected to have type ''a list' but here has type 'unit'
I'm new to F# and working on an entry project to get my feet wet. But, I'm having trouble understanding a particular design pattern related to the type-checking conducted in function returns.
The ...
0
votes
0
answers
110
views
xunit test in VSCode on Windows doesn't stop on breakpoint
I am trying to use XUnit for testing my f# code.
module UnitTest1
open Xunit
open Program
open System.Diagnostics
[<Fact>]
let Test1 () =
Debugger.Break()
Assert.True(true)
The test ...
0
votes
0
answers
69
views
How can I apply these attributes in F# ASP.NET minimal APIs?
I'm trying to convert this C# example from the .NET Minimal APIs Quick Reference that sets up a keyed service.
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddKeyedSingleton<...
1
vote
0
answers
71
views
Microsoft.EntityFrameworkCore.Sqlite TOP and LIMIT SQL syntax error
In Entity Framework Core 9.0.9, the query builder fails with SQLite Syntax
builder.Services.AddDbContext<MyDbContext>(fun options ->
options.UseSqlite(connectionString) |> ignore
It ...