[Haskell-beginners] Most important Functional Methods

Richard Seldon arcseldon at gmail.com
Sat Jun 7 05:21:25 UTC 2014


Hello,

I have a general question, not specific to Haskell although I am learning Haskell as I ask this question..

Please can someone provide consensus on the most important functional methods in their view.

I read somewhere that having map, reduce, filter, mergeAll, and zip pretty much means everything else can be derived.

Further, what I specifically want to know is whether flatMap should be included as an implementation in a functional library, or whether it should be excluded because it is derivable using “building block” functions.

Hope this makes sense.

In languages like JS, there is a lot of resistance to include flatMap in prominent libraries such as underscore and lodash.

Am curious to know what the Haskell community view is here, or whether in this community too opinions are widely divided.

Alternatives I have seen are:

1). Chaining functions together chain(map(), map()
2). Using reduce()  - which seems so versatile like a for loop for anything if really want
3). Using flatten(), or chaining pluck and flatten
4). Using map flatten compact  - this gets rid of null, undefined etc in a language like JS too

Recently, Reactive extensions have got really popular and it seems increasingly that flatMap is ideal for these situations.

Would welcome some general advice and thoughts. If this is off-topic of course, then sorry to have caused any inconvenience.
My thoughts are that the Haskell community have the necessary experience regarding functional programming in general to offer opinion.

Best regards,




More information about the Beginners mailing list