Is there a way to build a useful application based entirely on the functional paradigm?

13

The functional paradigm, in theory, is beautiful to see. Pure Functions , immutable objects and predictable outputs. This can facilitate development, decrease the incidence of bugs , and help maintainability. From this, is there a way to build a useful fully based application in functional programming?

In my view, any external communication or side effect as:

  • print in console ;
  • consume system date / time;
  • save / retrieve data from a database

It hurts the pillars of the functional paradigm.

How does building an application with functional programming work? Is there no way to fully respect this paradigm to build something real / useful?

If I want to build something, should I have part of my functional code and the impure part separated into another paradigm that allows me to externally interact? In general, how do functional languages (F #, Erlang / Elixir, Scala) handle this? Or do not even deal?

Consider a useful - I can and I'm generalizing - application that communicates with external systems such as databases and / or APIs.

    
asked by anonymous 23.11.2017 / 02:48

1 answer

8
  

Is there a way to build a useful application based entirely on functional programming?

Are compilers useful? It is a domain where this paradigm works very well.

Is Big Data, Machine Learning useful? Functional programming works very well with this. Maybe not in all nuances of these technologies, but in several of them goes very well.

  

Any external communication hurts the pillars of the functional paradigm. How does building an application with functional programming work? Is there no way to fully respect this paradigm to build something real / useful?

Purity of paradigm is difficult to achieve even. If you want, and no language I know is 100% functional (some adapt the concept to say that its language is), there it could only do data manipulations existing in the code itself, nothing external.

Nor is it imperative to be 100% pure, even if it does.

  

If I want to build something, should I have part of my functional code and the impure part separated into another paradigm that allows me to externally interact?

Basically this is it.

  

In general, how do functional languages (F #, Erlang / Elixir, Scala) handle this? Or do not even deal?

These, in general, do not deal, they are functional until page 3:)

It has languages that use Monads to address external communication by encapsulating what is impure from the rest of the code, so, in a certain way, we can continue considering as functional programming since the rules placed in the Monad create a certain determinism and do not cause side effects, maintaining the referential transparency, that is, Monad is pure even if internally he does impure things, he is not contaminated (at least conceptually).

    
23.11.2017 / 04:30