← Back to context

Comment by mrkeen

14 days ago

> Is it wrong for me to expect that most programmers are already familiar with functions that only use their inputs

They'll experience no friction when using Haskell then. Haskell only refuses to compile when you declare "Oh yeah I know functions from other languages this is easy" but then do some mutation in your implementation.

> They'll experience no friction when using Haskell then.

The question was what benefit you'd get from learning a functional language, though. Existing knowledge making it easier to switch to a functional language is the inverse of that.

And there's no assumption they'll actually be making things in Haskell, so easy switching isn't by itself a benefit.

  • Yeah I can't really follow these threads.

    I saw:

    > What's the benefit of learning a PURE functional programming language, opposed to just using a language which has adapted the best bits and pieces from the functional programming paradigm?

    I also saw:

      Though you can break purity with just inputs:
    
      define f(o): return o.x
      let a = {x=1}
      f(a)
      a.x = 2
      f(a)
    

    I don't know if that's the tail-end of a reductio ad absurdum which is trying to demonstrate the opposite of what it stated. Either way, to be clear, the above would be rejected by Haskell (if declared as a pure function.)

    I guess if you learn a functional language "which has adapted the best bits and pieces from the functional programming paradigm" then you might think that the above is broken purity, but if you learn a "PURE functional programming language" then you wouldn't.

    • The topic is what you would learn from a pure functional language.

      A) You can learn and enforce full purity in other languages. B) You could also learn and adapt just the idea of clean inputs and outputs to those other languages.

      Both of those are valid answers! It's very hard to be completely pure if you're not currently using Haskell.

      The way they worded things, I wasn't sure which one they meant. They were describing option B, but I didn't know if that was on purpose or not.

      So I responded talking about both. Complete purity and just the idea of clean inputs and outputs.

      That code snippet is not some kind of absurd argument or strawman, it's there to demonstrate how the description they gave was not a description of purity. It's not aimed at the original question.