I cannot define a literal in the F # signature file.
I have a file File.fsas shown below:
module Thingo =
[<Literal>]
let hello = "world"
I need to create a signature file for it, so I initially tried this ( File.fsi):
module Thingo =
[<Literal>]
val hello : string
This caused the following error in File.fsi:A declaration may only be the [<Literal>] attribute if a constant value is also given, e.g. 'val x : int = 1'
I gave this:
module Thingo =
[<Literal>]
val hello : string = "world"
The line after the announcement val helloreceived an error:Incomplete structured construct at or before this point in signature file. Expected incomplete structured construct at or before this point or other token.
Therefore, I do not like to assign values in the signature file (or I do not know how to assign a value, this is very possible).
The docs say that I need to somehow assign a value to the signature:
If an attribute is used Literal, it must appear both in the signature and in the implementation, and the same literal value must be used for both.
( https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/signatures)
( --sig build) :
module EventSchema = begin
[<LiteralAttribute ()>]
val id : string
end
, .
! .