I am trying to model a domain in FSharp. And I would like client code to experience clean access to these types. So part of it is by creating a signature file (.fsi), which is described here: https://msdn.microsoft.com/en-us/library/dd233196.aspx
The Microsoft page does not describe how inheritance works in FSharp signature files. I did discover how to indicate an interface implementation with the "interface" keyword here: https://github.com/intellifactory/websharper.ui.next/blob/master/WebSharper.UI.Next/Attr.fsi
Nice. But I wanted to take it a step further, and inherit from an abstract class, and indicate that in the signature file.
The goal is polymorphism. Somewhere, I want a function to take a parameter "v" as: (v : S list), where S is a supertype and the list may consist values of its subtypes.
But what is the syntax in an fsharp signature file for inheritance from an abstract class?
In "Artefact.fs" I have (yes, its a Websharper project):
[<JavaScript; AbstractClass>]
type Artefact() =
abstract member Visual : Doc with get
And in "Visual.fsi" I have:
[<JavaScript; Sealed>]
type Visual =
inherit Artefact
The "inherit" line does not compile. So what is the right syntax?
I tried these (which also don't work):
1) brackets after Artefact
[<JavaScript; Sealed>]
type Visual =
inherit Artefact()
2) brackets after Visual
[<JavaScript; Sealed>]
type Visual() =
inherit Artefact
Any ideas?