17,066 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
-1
votes
0
answers
23
views
What is the best way to compare API JSON response values in F#?
I need to test that API responses in JSON are as expected, not just the structure but the actual values themselves.
There are a few ways to compare API JSON response values in C# such as JToken....
0
votes
0
answers
55
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....
Alex 75's user avatar
- 3,276
0
votes
1
answer
61
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
55
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 ...
0
votes
1
answer
50
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 ...
0
votes
0
answers
28
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 ...
Alex 75's user avatar
- 3,276
0
votes
0
answers
52
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....
0
votes
1
answer
51
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 (...
sdgfsdh's user avatar
- 37.3k
-1
votes
2
answers
125
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
22
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 & #...
0
votes
1
answer
39
views
Semicolon vs new line for sequenting
In many places, it is said that semi colon and new lines are same for sequenting. Eg here. But I think it's not correct. Consider the following two codes :
let d = 4 ; d ;;
then I get the following ...
0
votes
1
answer
52
views
Invoking effects by let () = (effects) vs by (effects)/ do effects
If we load the F# REPL (dotnet fsi in terminal) and write for example
let () = printfn "hello";;
then the output is "hello", but if we write
printfn "hello";;
then the ...
1
vote
2
answers
58
views
How to define an infinite recursive object which is defined through discriminated union?
Suppose I define this variant type
type Sequence =
| Seq of type-1 * Sequence
And let's suppose in Repl I want to some how encode the sequence using this, then how can I do it? For ...
1
vote
0
answers
36
views
Utility of yield keyword in f sharp
So far I know, we use it mostly for list/array comprehension. Here is two codes:
[ for x in range do (yield expression)]
else we can also drop the yield and still it works
[ for x in range do ...
0
votes
1
answer
41
views
Why is the value of (y:=!y+1 ;!y) + !y and !y + (y:= !y+1 ; !y) different in f#?
Suppose in the repl we write
let y = ref 0
then if we follow this by (y:=!y+1 ;!y) + !y , we get 2 but if we reset $y$'s value then do !y + (y:= !y+1 ; !y) we get 1.
Why does it change depending on ...