How do you explain that purely functional web servers like Ring and Yesod are not MVC?

Traditionally, people think of web applications as MVC, which assumes an object-oriented context.

A critical analysis of functional programming - and offers a model using higher order functions and immutable data structures.

My question is: How do you explain that purely functional web servers like Ring and Yesod are not MVC?

+4
source share
4 answers

l Will try to answer this with respect to Yesod.

How do you explain that purely functional web servers like Ring and Yesod are not MVC?

Yesod is not a web server. Yesod is a web framework. warp is the recommended web server for use with Yesod.

How do you explain that purely functional web servers like Ring and Yesod are not MVC ?

This is not necessarily true. You can use templates as a view, persistent as a model, and routing and transfer as a Controller. In fact, the forest site follows freely the MVC approach.

A critical analysis of functional programming - and offers a model using higher order functions and immutable data structures.

This has nothing to do with this MVC. MVC is just a design template. Higher-order functions and fixed data structures do not prevent you from following some architecture or design pattern.

+13
source

You can assume the OO context for MVC and where it was born, but you certainly don't need this. MVC simply says that Model, View and Controller should be separate things, interacting in a certain way; in OO languages, it’s convenient to represent them as classes, but this is not necessary. See MVC and Purity :

Being prone to purely functional programming, I now believe that separating the controller from the model / view is like the difference between a side effect of code (IO) and pure code.

+7
source

Functions of a higher order and invariable data structures are what functional programming is, just like classes / objects, what OOP is about, so it seems natural that the functional structure of the web server will mainly use functional tools (functions, structures data) where possible.

http://www.yesodweb.com/book/routing-and-handlers starts with "If we look at Yesod as a Model-View-Controller", ... so I don’t know, It seems you quite understand your question . What do you have in mind?

+3
source

The ring is low enough that it makes no sense to talk about it as MVC or not: it's just your adapter to the HTTP protocol. You can read the headers / request body, write response headers / body, etc., but nothing happens in updating domain objects; that up to what you lay on top of the ring.

+3
source

All Articles