如何在 .NET Core 中运行 F# 交互 (fsi.exe)?它已经支持了吗?

23

我无法在.NET Core的Windows或Linux上找到fsi.exe运行文件,可能它还未被支持?


1
你找到了一种在.NET Core中使用F# REPL的方法吗? - jmrah
2个回答

7

3
请纠正我如果我错了,但是今天(12月'19)
在Ubuntu 18.04上,使用标准的安装指令从https://learn.microsoft.com/en-us/dotnet/core/install/linux-package-manager-ubuntu-1904https://fsharp.org/use/linux/,可以在netcore中使用f#互动式界面。
// file: runtime.fsx
open System
open System.Reflection
open System.Runtime
open System.Linq

Type.GetType("Mono.Runtime")
|> printf "Mono.Runtime: %A\n"
(Assembly.GetEntryAssembly().GetCustomAttributesData()
         .FirstOrDefault((fun a -> 
            a.AttributeType = typedefof<Versioning.TargetFrameworkAttribute>)))
         .ConstructorArguments
|> printf "Framework: %A\n"

$ fsi runtime.fsx 
Mono.Runtime: Mono.Runtime
Framework: seq [".NETFramework,Version=v4.6"]

...

$ dotnet fsi runtime.fsx 
Mono.Runtime: <null>
Framework: seq [".NETCoreApp,Version=v2.1"]

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接