I propose we provide a more succinct way to write flexible type that's compatible with multiple base types or interfaces.
Currently in F#, doing so requires writing a rather tedious type constraint, for example:
let multipleInterfaces (x: 'a when 'a :> IEquatable<'T> and 'a :> IComparable) = ()
//or hacking with type alias
type EquatableAndComparable<'T, 'a when 'a :> IEqutatable<'T> and 'a :> IComparable> = 'a
let multipleInterfaces' (x: EquatableAndComparable<'T, 'a>) = ()
A possible syntax could be:
let multipleInterfaces (x: #(IEquatable<'T> and IComparable)) = ()
Pro: This saves some extra typing.
Con: Adds a little more cost to learn the language.
Estimated cost (XS):
See "Protocol Composition" on https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Protocols.html#//apple_ref/doc/uid/TP40014097-CH25-ID267
Please tick this by placing a cross in the box:
Please tick all that apply: