Search code examples
programming-languagesfunctional-programming

Why purely functional languages instead of "impure" functional languages?


What's the advantage, for someone who is not a theoretical computer scientist, of learning a purely functional language like Haskell or Erlang instead of an "impure" language with a strong functional component, like Python or version 2 of the D programming language? My arguments are as follows:

  1. No paradigm is perfect. Languages that are single-paradigm, regardless of what paradigm that is, are very restrictive.
  2. Python or D will ease you into functional programming while you get real work done. Haskell or Erlang will force you to learn functional style all at once before you can actually do anything of interest in them.

Edit: By "impure" functional languages, what I really mean is strongly multiparadigm languages w/ a functional flavor, not strongly functional languages with some non-functional abilities.


Solution

  • It all depends on what are trying to achieve. If your goal to write production code in a functional language - a 'pure' functional language can make it more difficult.

    But if you are trying to learn new concepts, 'pure' language gives you the benefit of guarding where you are sliding off the mark of functional concepts. Once you have clear understanding of differences you can go to a mixed environments - like F#, but before that it is all too easy to slip to the OOP way of doing things and because of this miss the advantages of functional approach.

    In some other thread I offered an opinion that a better way of learning F# is to start with let us say Haskell (and was voted down for this), but if you learn F# to do OOP than what's the point - stay with C#