How to implement an interface member that returns void in F#
Posted
by Drew Noakes
on Stack Overflow
See other posts from Stack Overflow
or by Drew Noakes
Published on 2010-06-18T06:25:34Z
Indexed on
2010/06/18
6:33 UTC
Read the original article
Hit count: 314
Imagine the following interface in C#:
interface IFoo {
void Bar();
}
How can I implement this in F#? All the examples I've found during 30 minutes of searching online show only examples that have return types which I suppose is more common in a functional style, but something I can't avoid in this instance.
Here's what I have so far:
type Bar() =
interface IFoo with
member this.Bar =
void
Fails with FS0010: Unexpected keyword 'void' in expression.
© Stack Overflow or respective owner