Description
NOTE: Current response by @dsyme is here: #243 (comment)
Submitted by exercitus vir on 4/12/2014 12:00:00 AM
392 votes on UserVoice prior to migration
(Updated the suggestion to "type classes or implicits", and edited it)
Please add support for type classes or implicits. Currently, it's possible to hack type classes into F# using statically resolved type parameters and operators, but it is really ugly and not easily extensible. I'd like to see something similar to an interface declaration:
class Mappable =
abstract map : ('a -> 'b) -> 'm<'a> -> 'm<'b>
Existing types could then be made instances of a type classes by writing them as type extensions:
type Seq with
class Mappable with
member map = Seq.map
type Option with
class Mappable with
member map = Option.map
I know that the 'class' keyword could be confusing for OO-folks but I could not come up with a better keyword for a type class but since 'class' is not used in F# anyway, this is probably less of a problem.
Activity