Interfaces are not functional, but inherently OO in the sense that there is always an object involved to which you send a message (= call member of the interface). So interfaces are contracts for objects (or values, but this does not help) and not for types. #fsharp
Programmers used to interfaces and not used to type classes rarely think of this example: wouldn’t it be natural and useful to have “empty collection” as part of, say, ICollection<‘t>? That would be a contract for type t itself as opposed to values of t. #fsharp
So static interface members are actually a very exciting feature which makes interfaces more functional and strictly more expressive and therefore useful. #fsharp
• • •
Missing some Tweet in this thread? You can try to
force a refresh
I write #fsharp and #haskell daily (and #purescript too) and thought of making a micro-blog comparison of the two. Fun facts and maybe new discoveries for the interested, in no particular order. This will be long and probably slow.
Unlike #fsharp, #haskell has no records, only discriminated unions. It does have something called “record syntax” for DUs.
In #fsharp functions cannot be overloaded. In #haskell it is possible through the “type classes” mechanism, conceived specifically for this.