f#

How to generate F# signature file (without Visual Studio)

纵然是瞬间 提交于 2021-02-11 04:53:42
问题 I' m using JetBrains Rider on MacOS and experimenting with code from Scott Wlaschin Domain Modelling Made Functional Here are my module definition and it dependencies: module internal DomainModeling.Domain.PlaceOrderWorkflow.Internal open DomainModeling.Domain.Api open DomainModeling.Domain.Primitives open DomainModeling.Domain.Utils I want to generate signature file from this module. But I'm confused of using dotnet builder or fsharp compiler. If I use dotnet command I can't pass flag --sig

How to generate F# signature file (without Visual Studio)

删除回忆录丶 提交于 2021-02-11 04:51:44
问题 I' m using JetBrains Rider on MacOS and experimenting with code from Scott Wlaschin Domain Modelling Made Functional Here are my module definition and it dependencies: module internal DomainModeling.Domain.PlaceOrderWorkflow.Internal open DomainModeling.Domain.Api open DomainModeling.Domain.Primitives open DomainModeling.Domain.Utils I want to generate signature file from this module. But I'm confused of using dotnet builder or fsharp compiler. If I use dotnet command I can't pass flag --sig

System.Array [] not compatible with float [] [] in F#

好久不见. 提交于 2021-02-10 14:26:52
问题 I need to call a function that takes System.Array [] as one parameter in F#. (The function is in a library). I need to pass an argument of type float [] [] [] but the compiler refuses to compile. To replicate the problem, I wrote the following code let x : float [] [] = Array.init 2 (fun x -> Array.zeroCreate 3) x :> System.Array;; // This is OK val x : float [] [] = [|[|0.0; 0.0; 0.0|]; [|0.0; 0.0; 0.0|]|] > x :> System.Array [];; //Error x :> System.Array [];; ^^^^^^^^^^^^^^^^^^^^ stdin(14

System.Array [] not compatible with float [] [] in F#

血红的双手。 提交于 2021-02-10 14:24:31
问题 I need to call a function that takes System.Array [] as one parameter in F#. (The function is in a library). I need to pass an argument of type float [] [] [] but the compiler refuses to compile. To replicate the problem, I wrote the following code let x : float [] [] = Array.init 2 (fun x -> Array.zeroCreate 3) x :> System.Array;; // This is OK val x : float [] [] = [|[|0.0; 0.0; 0.0|]; [|0.0; 0.0; 0.0|]|] > x :> System.Array [];; //Error x :> System.Array [];; ^^^^^^^^^^^^^^^^^^^^ stdin(14

F# type test pattern matching: decomposing tuple objects

半腔热情 提交于 2021-02-10 14:19:57
问题 Just curious why I can't do this: let myFn (data : obj) = match data with | :? (string * string) as (s1, s2) -> sprintf "(%s, %s)" s1 s2 |> Some | :? (string * string * int) as (s1, s2, i) -> sprintf "(%s, %s, %d)" s1 s2 i |> Some | _ -> None How come? 回答1: See F# spec, section 7.3 "As patterns" An as pattern is of the form pat as ident Which means you need to use an identifier after as : let myFn (data : obj) = match data with | :? (string * string) as s1s2 -> let (s1, s2) = s1s2 in sprintf

Reading cell contents in an Excel file with F# and Open XML SDK

天涯浪子 提交于 2021-02-10 13:16:55
问题 I can't compile the following code, which has been translated from C#. The compiler produced this error: error FS0010: Incomplete structured construct at or before this point in implementation file. Expected incomplete structured construct at or before this point or other token. // Assemblies open System open System.Linq open System.Data open System.Windows open DocumentFormat.OpenXml // Also install DocumentFormat.OpenXml from nuget open DocumentFormat.OpenXml.Packaging open DocumentFormat

Reading cell contents in an Excel file with F# and Open XML SDK

╄→尐↘猪︶ㄣ 提交于 2021-02-10 13:16:00
问题 I can't compile the following code, which has been translated from C#. The compiler produced this error: error FS0010: Incomplete structured construct at or before this point in implementation file. Expected incomplete structured construct at or before this point or other token. // Assemblies open System open System.Linq open System.Data open System.Windows open DocumentFormat.OpenXml // Also install DocumentFormat.OpenXml from nuget open DocumentFormat.OpenXml.Packaging open DocumentFormat

This construct causes code to be less generic than indicated by the type annotations

旧城冷巷雨未停 提交于 2021-02-10 09:13:34
问题 So I'm getting the "This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type 'CountType'." warning, and the constraint is causing a problem in other bits of the code. I've tried making the type explicitly generic, but it's not working. I've put this code on tryfsharp to make it easier to play with. Apologies for the mound of code, I tried cutting it down and simplifying some types. module Stuff type CountType =

This construct causes code to be less generic than indicated by the type annotations

馋奶兔 提交于 2021-02-10 09:08:29
问题 So I'm getting the "This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type 'CountType'." warning, and the constraint is causing a problem in other bits of the code. I've tried making the type explicitly generic, but it's not working. I've put this code on tryfsharp to make it easier to play with. Apologies for the mound of code, I tried cutting it down and simplifying some types. module Stuff type CountType =

This construct causes code to be less generic than indicated by the type annotations

我与影子孤独终老i 提交于 2021-02-10 09:07:57
问题 So I'm getting the "This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type 'CountType'." warning, and the constraint is causing a problem in other bits of the code. I've tried making the type explicitly generic, but it's not working. I've put this code on tryfsharp to make it easier to play with. Apologies for the mound of code, I tried cutting it down and simplifying some types. module Stuff type CountType =