Remix.run Logo
frumplestlatz 4 days ago

Perhaps you can provide a concrete example.

I’ve seen Haskell’s type class hierarchy successfully realized in all sorts of languages, from Scala to Swift.

- https://github.com/scalaz/scalaz

- https://bow-swift.io/

As for monads themselves, the concept emerges everywhere, with or without Haskell’s particular type classes. Case in point is Swift’s handling of Optional and Optional chaining.

lmm 3 days ago | parent [-]

People unaware of the laws invent things that are almost monads but break in edge cases. E.g. Scala's collections with flatMap where you can mix and match collection types are almost, but not quite, monadic. Javas Optionals as discussed in parallel threads are similarly almost, but not quite, monadic. And this kind of almost correct implementation is more dangerous than a blatantly incorrect one.