17,064 questions
1
vote
1
answer
93
views
How to find and read files with malformed names in .NET?
I have deliberately create a file with a malformed name:
printf '\xC3\x28malformed_name.txt' | xargs touch
Verifying it exists:
ls
''$'\303''(malformed_name.txt'
.NET can also see the file:
open ...
0
votes
1
answer
29
views
View.map in Fabulous.MAUI throws the error "No overloads match for method 'Yield'"
I want to write an app in F# Fabulous.MAUI and follow the example from Fabulous where each page is written in a separate file.
I used the template from Fabulous.MAUI in app.fs but reduced it to two ...
0
votes
1
answer
67
views
Value of a mutable variable is not updated in XUnit test
I wrote an XUnit test in F# for a function that updates a mutable variable:
[<Fact>]
let ``UpdatePlayerOneAmountTests`` () =
//-- Arrange
let input = new StringReader "10"
...
1
vote
1
answer
67
views
F# automatic visible type annotations in Visual Studio
I've moved to working in Visual Studio recently (instead of VS Code) and I see that there are no automatic type annotations like in VS Code. Googling won't help to find a solution.
In the attached ...
2
votes
0
answers
91
views
FSharp inlining downcast optimization?
I am currently reading through the F# core library source code and stumbled upon a common pattern which made me wonder a little about the performance of it, and could not find anything about it by a ...
1
vote
1
answer
55
views
Using IConfigurationRoot to retrieve user secrets in f# [closed]
A bare bone implementation for retrieving user secrets using F#
I am new to f# (coming from c#) and I was looking to retrieve user secrets for a bare bone CLI project. I did not want to import ...
0
votes
0
answers
70
views
Visual Studio does not show the possible use
I have this F# code:
let readTemplate template =
let assembly = System.Reflection.Assembly.GetExecutingAssembly()
use stream = assembly.GetManifestResourceStream ($"Api.services.Email....
0
votes
1
answer
81
views
Can anyone see what is wrong with my transpose function in F#?
Given a list of tuples, where each tuple consists of 3 integers, transpose the list recursively so that the "rows" and "columns" are swapped. The result will be a list of lists.
So ...
1
vote
1
answer
82
views
F# testing using mstest cannot resolve method overload
As a learning exercise, I'm trying to test some F# code using MSTEST. I've run into a problem that is driving me crazy, not because I can't work around it, but because I don't understand how to ...
1
vote
1
answer
66
views
Problem with F# inferred generic type constraints
I have the following F# example. It compiles. However, no matter what I tried, I was unable to make member inline md.mean (x : SubstanceData<^I>) : ^C compile. The compiler immediately tells me ...
1
vote
1
answer
55
views
Delete function with where clause on a option
I have this entity (I left only relevant fields):
type UserSession = {
Id: string
CreatedAt: DateTime
LastRefreshAt: DateTime option
}
and in my UserSessionRepository.fs I have this ...
0
votes
0
answers
59
views
F# FSharp.Data.SqlClient error 0x8007007E
I'm attempting to implement the very first example from here and I'm getting Unable to load DLL 'sni.dll' or one of its dependencies error. I have .NET 8/VS Code. Any thoughts?
#r "nuget: FSharp....
1
vote
1
answer
61
views
Why does this usage of Async.Parallel never complete?
Running this code:
open System
async {
printfn "a"
do!
Async.Parallel [|
Async.FromContinuations ignore // Sleep forever
async { return raise (...
-1
votes
2
answers
149
views
Does string interpolation work the same for C# and F#?
I expected string interpolation to be the exact same for F# and C#.
This is fine for C#:
var x = $"{123:00000000}";
This does not work for F#:
printfn $"{123:00000000}"
Looking ...
0
votes
1
answer
33
views
Retrieving generic interface implementation constraints with F# reflection
This F# code
open System
open FSharp.Reflection
let getInterfaces f: Type seq = Unchecked.defaultof<_>
//retrieve interfaces constraining the env argument of f
let a (env: #IDisposable & #...