-
-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
Here is how you would currently write a minimal API style bot in F#:
let builder = Host.CreateApplicationBuilder()
builder.Services
.AddApplicationCommands()
.AddDiscordGateway() |> ignore
let host = builder.Build()
host.AddSlashCommand("ping", "Ping!", Func<string>(fun() -> "Pong"))
.UseGatewayEventHandlers() |> ignore
host.Run()
Currently, Func<string>(...)
is needed for minimal API commands. To improve the experience, it would be needed to provide generic overloads with FSharpFunc<...>
. This issue would also be resolved by fsharp/fslang-suggestions#1131.
Of course extensions for services themselves would also be added.
I am also probably unaware of other places in which extensions for F# would be needed. Feel free to suggest them.
The package naming would be {PackageName}.FSharp
, so for example it would be NetCord.Hosting.FSharp
for NetCord.Hosting
.
I think it would be better to write the extensions in F#, as only F# methods can be inlined and optimized by the compiler.
neon-sunset
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request