2 ms·
That doesn't make functors and monads impossible to implement.
by siwatanejo 6y ago
That doesn't make functors and monads impossible to implement.
- smabie 6y agoOf course not, but it means that there is no type that abstracts upon all of them. For example, in Haskell, you can >>= and >> just about everything and it'll work. In OCaml (and I assume F#), you have to import the right kind of >>= and >>. This is quite burdensome and creates a lot of repetitive and nasty code. The lack of polymorphism in ML languages is such a bummer.
- HappyDoge 6y agoOstensibly yes, but F# has limited and clunky compile time ad-hoc polymorphism mechanism that can be used to implement "type classes" - which however can be abused to great effect if you really want generalised binds https://github.com/fsprojects/FSharpPlus https://github.com/fsprojects/FSharpPlus. Not to mention it has subtype polymorphism on par with what you get in C# that you can really get a lot of mileage from (and which gets too easily glossed over by some FP neophytes), AND an extensive reflection API to bridge the gap if you have nothing else to fall back to.