Can I start web development using a functional language?

I would like to start doing some forms of web development with the goal of creating web applications that could eventually turn into launch products. And for a long time I was very curious about functional programming, and somewhere in my heart secretly believing that the higher you go to the level of abstraction, the more you have (hidden presumption: functional programming is more abstract than procedural).

So, given the little experience on the Internet, I have, is there any functional language / framework with which to start to learn web development ?

The alternative is to stick to a mature procedural web structure (possibly Django), first explore the possibilities of web development, and then think about functional programming. However, all the work will be "wasted" if I eventually move on to functional programming.

I have pretty good experience with C ++, Objective-C / Cocoa, familiar with Python.

EDIT: Many people offer F #. But I would love (no offense for others) to stay away from the .NET platform and other MS ecosystems.

+6
django functional-programming
source share
10 answers

You may be interested in Ocsigen , a web infrastructure for OCaml . OCaml is a pretty good language for learning functional IMO programming. It is really highly functional, unlike Ruby or Python or any other imperative OO language, people will try to sell you as โ€œcapable of performing functional programmingโ€ (with the help of which they simply mean that it has first-class functions).

(Disclaimer: I did not use Ocsigen very well, but I heard about it well. It's on my list of things.)

+10
source share

You can learn F # as your functional language and ASP.NET MVC as your web infrastructure. This gives you access to tools and libraries in the .NET framework.

I took the first steps in web development using ASP.NET MVC, and I found it pretty simple to get started.

And you can also look at F # Web Tools , as Ivolson suggested.

+7
source share

I do not know the web infrastructure, which is 100% working with the same power as ASP MVC / DotNetNuke / Ruby Rails.

Scala (a mixed OO and functional language) has a structure called Lift, which is similar to Rails.

+4
source share

With Haskell, you can certainly use CGI to write web applications. Cm:

Although with haskell, applications must be compiled and deployed (either compiled on a server or in an environment similar to a server).

I recently talked with this ... in general, I felt that it was not much more complicated than using the usual (statistically speaking) language. Here is an example of what the code might look like (after a kind of MVC approach):

CGI.hs:

module CGITest.CGI where import Network.CGI import qualified CGITest.Views as V import qualified CGITest.Data as D cgiMain = runCGI (handleErrors (do rows <- liftIO D.getAllData output $ V.drawPage $ V.drawTable rows )) 

Data.hs:

 module CGITest.Data where import qualified Data.Map as Map import Database.HDBC import Database.HDBC.Sqlite3 getAllData :: IO [Map.Map String SqlValue] getAllData = do conn <- connectSqlite3 "C:\\Personal\\code\\Code\\Haskell\\CGITest\\test.db" statement <- prepare conn "SELECT * FROM Test" execute statement [] rows <- fetchAllRowsMap statement return rows 

Views.hs:

 module CGITest.Views where import qualified Data.Map as Map import Data.Map ((!)) import Prelude hiding (div, id) import Text.HTML.Light hiding (head) import qualified Text.HTML.Light as H import Text.XML.Light.Types (Content) import Text.XML.Light import Text.JSON import Text.JSON.String import Database.HDBC tbody ze = Elem (Element (unqual "tbody") ze Nothing) thead ze = Elem (Element (unqual "thead") ze Nothing) drawPage x = renderXHTML xhtml_1_0_transitional $ html [] [ H.head [] [ title [] [cdata "Testing Haskell CGI"] ], body [] [ div [id "outer-container"] [ div [id "inner-container"] x, cdata $ show testJ ] ] ] drawRow columns = tr [class' "row"] [ td [] [cdata $ fromSql $ columns ! "id"], td [] [cdata $ fromSql $ columns ! "name"] ] where tId = "row-" ++ (fromSql $ columns ! "id") drawTable rows = [ table [border "1"] [ thead [] [ tr [] [ th [] [cdata "ID"], th [] [cdata "Name"] ] ], tbody [] $ map drawRow rows ] ] 
+3
source share

It's a bit off the wall, not a strict functional language, but you can consider erlang .

Erlang has a nice structure called Erlyweb and its own web server called Yaws .

It is powerful and offers awesome things for concurrency, but it is a very big mental shift from some other languages.

+3
source share
  • Ruby is somewhat functional, so you can use the high-value Rails framework (although it is not particularly functional).
  • I'm not sure if Seaside is structured inside, but it might be worth the look. (Ruby and Smalltalk are OO languages โ€‹โ€‹in which you can execute functional programming, rather than being primarily functional languages.)
  • Here is a discussion of the Haskell web frameworks .
+2
source share

SML Server is an Apache plugin that allows you to write in standard ML, a universal, functional language .

http://www.smlserver.org/

+2
source share

Yesod at Haskell passed 1.0.


(Assuming this late answer is just because Google still shows people (like me) this old question.)

+2
source share

And for a long time I was very interested in learning about functional programming, and somewhere in my heart, secretly believing that the higher you go to the level of abstraction, the more you have (hidden presumption: functional programming is more abstract than procedural) .

This "higher power of abstraction" is probably only applicable to code that you yourself write. Many frameworks / tools have helper functions, such as generating code to bind user interface data or map databases. This generated code will not function.

I do not know a web infrastructure that works 100% with the same functions as ASP MVC / DotNetNuke / Ruby Rails.

0
source share

Probably, you first need to do development in the Primorsky Territory. Take a look at the textbooks written by James Foster. This is apparently the highest level web infrastructure with the community.

-one
source share

All Articles