I'm having a problem compiling an old F# project located here. Offending file is here.
It uses mutual recursive types and it's correctly defined indentation-wise. But none the less, not EDNValue
nor EDNValueParsed
are seen at the same context/indentation level.
module EDNParserTypes =
type EDNException(message : string) =
inherit System.Exception(message)
type QualifiedSymbol =
struct
val prefix: string
val name: string
new (prefix, name) = {prefix = prefix; name = name}
override this.ToString() = "QualifiedSymbol Prefix: " + this.prefix + " Name: " + this.name
end
type EDNValue = EDNNil
| EDNBoolean of bool
| EDNString of string
| EDNCharacter of char
| EDNSymbol of QualifiedSymbol
| EDNKeyword of QualifiedSymbol
| EDNInteger of BigInteger
| EDNFloat of double
| EDNComment of string
| EDNDiscard of EDNValueParsed
| EDNTaggedValue of QualifiedSymbol * EDNValueParsed
| EDNList of string list
| EDNVector of string array
| EDNMap of List<string>
| EDNSet of List<string>
and EDNValueParsed =
struct
val line: int64
val col: int64
val ednValue: EDNValue
new (ednValue, line, col) = { ednValue = ednValue; line = line; col = col }
override this.ToString() =
sprintf "%A" this.ednValue
end
These two functions defined afterwards, fail compiling since EDNValueParsed
is not seen as defined. EDNParserTypes.fs(41,41): Error FS0039: The type 'EDNValueParsed' is not defined. (FS0039) (EDNReaderWriter)
let getLineColString (valueParsed : EDNValueParsed) =
System.String.Format("line: {0}, column: {1}", valueParsed.line, valueParsed.col);
let isNotCommentOrDiscard (v : EDNValueParsed) =
match v.ednValue with
| EDNComment _ | EDNDiscard _ -> false
| _ -> true
One curious thing, if I remove the lists part definition of the type, it doesn't fail (but obviously fails somewhere else where those definitions are needed)
With this part removed, types are properly defined:
| EDNList of string list
| EDNVector of string array
| EDNMap of List<string>
| EDNSet of List<string>
What am I missing?
If you have new version of VS you can not have old "pre-installed" version of FSharp.Core (4.0.0.0
).
So, reference like this:
<Reference Include="FSharp.Core, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
will be a broken.
I wasn't able to reproduce error from the question, but error which I got was pretty straightforward:
Could not resolve this link. Could not find assembly "FSharp.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
The type "FSharpList<>" is defined in an assembly that is not referenced. You must add a reference to assembly "FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
after correction the project build without errors.