5 ms·
> Some paradigms exemplified by the special languages are arguably unrealized or aspirational. [...] Haskell's pattern matching and monads end up being used mos
by riscy 10y ago
> Some paradigms exemplified by the special languages are arguably unrealized or aspirational. [...] Haskell's pattern matching and monads end up being used mostly as a vehicle to embed imperative programs.
Pattern matching has nothing to do with imperative programs and Haskell is not original for having it; it's been around since the 70s in ML. I would also argue that pattern matching has been realized in many popular languages (Scala, Swift, Ocaml, Rust ...)
- pizlonator 10y ago+1 You could argue that "Monads end up being used mostly as a vehicle to embed imperative programs", but pattern matching is a different beast. It's a joyful way to program, even for an imperative hacker like me.
- wyager 10y agoAgreed, and I think only someone who has not used much Haskell and has only really used the IO monad would say that monads are used mostly for embedding imperative programs. It also depends how you define an imperative program, but most monads are entirely pure and don't deal with sequencing or anything.
- saosebastiao 10y agoI came here to say exactly this, glad to see it already mentioned. I will point out though that the destructuring aspect of pattern matching predates ML slightly with the introduction of prolog, but the mixed in/out modality paradigm of prolog's pattern matching is sufficiently distinct from ML's that ML probably deserves the credit for influencing so many modern languages.
- mamcx 10y agoYou read it wrong. Him said that in Haskell PM & monads are using for make imperative code, NOT that is the defined trait of haskell, instead: "are arguably unrealized or aspirational"