Sign up ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Possible Duplicate:
Why Functional Programming

Hi, I'm new to functional programming. What isn't clear is: In what scenarios could functional programming be used?

One thing I understand is that functional programming is not meant to create business applications.

Is it a base for scientific applications?

Are there any real world examples which can be coded though haskell or other pure functional programming language?

share|improve this question

migrated from May 17 '11 at 7:20

This question came from our site for professional and enthusiast programmers.

marked as duplicate by ChrisF Sep 30 '12 at 19:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Free book available online: Real World Haskell: – Colin Pickard May 16 '11 at 15:54

3 Answers 3

is there any real world examples which can be coded though haskell or other pure functional programming language ?

There are:

in functional languages such Haskell. Same goes for Scala, Erlang, etc.

share|improve this answer

I wrote a SQL parser in Haskell a couple of years ago. With it, I was able to verify that our archive procedures were covering all of the tables and columns they needed to. It's been useful for answering other questions, for example: "Which stored procedures update table X?"

Of course, I could have written the parser in C#, but it would been a lot longer; I only needed about a thousand lines of Haskell code.

share|improve this answer
Dude! I was looking for a tool that would tell me this exact answer: "Which stored procedures update table X?" as well "Which stored procedures return results from table Y?" as well as "Which tables does the stored procedure Z update?" as well as "Which tables are used in the output of a stored procedure W ?". I do not know neither Haskell nor compilers, so I started hand-coding a state machine in Python and this quickly got out of hand. With every additional edge case my script exploded. Is this something that you can share? Can you point me to other resources? Which SQL vendor was this? – Job Jun 21 '11 at 22:17
If it helps at all, MSSQL has sp_depends (remember to call sp_refreshsqlmodule before so to refresh meta-data). – Martin Blore Jun 21 '11 at 22:56
@Martin Blore, thank you! This looks promising. I will test it out. – Job Jun 21 '11 at 23:37
@Job: The place where I work considers this proprietary software, so I can't share it with you, but it's not difficult to write a SQL parser in Haskell, it's just a lot of work. – Larry Coleman Jun 22 '11 at 1:11

One obvious advantage with functional programming is that it is easier to make stateless things parallel, as there's less locking needed. Most functional languages still have state-keeping tricks (either passing environments representing the state down the chain or by using monads), but in general it's less of a problem than for code that uses state-manipulation extensively.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.