
Functional Programming Jargon - charliejrgower
https://github.com/hemanth/functional-programming-jargon
======
nicolast
May be worth to mention a 'Functor' in OCaml is a different kind of beast than
the 'Functor' explained in this article (which is ~ the Haskell Functor type-
class).

~~~
eru
And perhaps add something about (OCaml) modules in that case?

The whole list seems to be mostly Haskell-inspired terminology translated to
JavaScript(?), so OCaml-style modules and thus functors might make less sense
to describe thoroughly. (Even though the OCaml people have a better claim to
be using Functor in something resembling its mathematical meaning.)

~~~
GreaterFool
> Even though the OCaml people have a better claim to be using Functor in
> something resembling its mathematical meaning.

I think that is not accurate. Haskell's notion of a functor is basically taken
from category theory. Same with applicative functor. It is easy to draw
commutative diagrams for things like `Maybe` or `Either a` to prove it!

In contrast in OCaml functors are module functions. Do modules form
categories? Maybe? I haven't seen anyone talking about category of OCaml
modules. Perhaps in some papers. But even if they do I wouldn't call OCaml's
claim better. When one says Functor in Haskell it is generally understood as
"the category theory thing". When one says functor in OCaml I think most
people, myself included, would think "module function", whether it satisfies
category-theory requirements or not.

Also, worth pointing out that OCaml too has applicative functors. Those are
such functors that when applied to same modules produce same types. Whether
that fits with the category-theoretic notion of applicative functor... haven't
thought about that! Maybe?

Basically

    
    
        module M1 = Make(F)(G)
        module M2 = Make(F)(G)
    

then if `M1.t` is the same as `M2.t` for some `t` the we have an applicative
functor. The other side of the coin are generative functors: each time you
apply them they mint new types:

    
    
        module M1 = Make(F)(G)()
        module M2 = Make(F)(G)()
    

Then `M1.t` /= `M2.t`. This has been introduced in OCaml `4.02`

~~~
eru
Thanks! The main point against Haskell functors being 'proper' is that they
only work in the category of 'Hask'.

~~~
LeanderK
well, there is always:
[https://github.com/mikeizbicki/subhask](https://github.com/mikeizbicki/subhask)
which provides more flexibility on the categories you are programming in.

------
reborg
I assume @hemanth is happy for the project README to appear on the blog of a
recruitment agency. Along with the rest of the blogs that seem to be copy
pasted from the original location. Should I guess functional-works obtained
permission from all the original copyright holders?

~~~
arianvanp
Original article is here: [https://github.com/hemanth/functional-programming-
jargon/blo...](https://github.com/hemanth/functional-programming-
jargon/blob/master/readme.md)

Functional works does not mention the MIT license and thus is allegedly
infringing on his copyright.

They link to the original source though. And the author seems to be hemanth
himself. So perhaps this is all false alarm.

~~~
charliejrgower
We absolutely receive permission before we publish anything. With final
approval coming from the author before anything goes live.

We have a platform that givs visibility to the great work that’s being done in
the functional space.

~~~
Sir_Cmpwn
>We have a platform that givs visibility to the great work that’s being done
in the functional space.

Wow, that's disingenous. That's nothing like what you do. You have a platform
that promotes your brand by copying and pasting other people's content into a
worse presentation with your logo in a sticky navbar stuck to the top of the
page.

------
jw-
I think the jump from 'Category' to 'Value: Anything that can be assigned to a
variable.' was a somewhat jarring change in abstraction level.

Also, trying to explain Monad, Comonad, or Applicative as 'jargon' is probably
a step too far IMO. They are not important for getting started with FP, and
describing them without their equational properties is kind of meaningless.

That being said I liked alot of the inclusions; partial application, closure,
composition. I think the collection is probably slightly guilty of trying to
be too clever by including advanced concepts.

~~~
sidlls
These terms provide a concise way to communicate more complex concepts in a
technical, specialized context: practically the definition of "jargon."

But that's also the reason I agree with you as regards their utility in most
programming. Simply knowing the "what" of the definitions is barely a start.
Those who know the definitions and are comfortable enough with the material to
use them effectively would find little value in lists of this sort. For most
(almost all) programming efforts outside a very narrow niche of academic
applications it's not even necessary.

------
jefozabuss
Found two bugs with the page (in case a developer is reading this thread)

I clicked on any topic in the list and it just scrolled me to the top of the
page. (Mac OS + Chrome latest / Safari latest)

Also if you refresh the page with a url which has a #link in it it will reload
with an empty-ish content.

~~~
fnwx17
Hey, thanks for pointing it out - the first one we’re currently looking into
as we’re using github style markdown, but the second one is fairly new.

We’ll launch a new version of the site mid December which will address the
current issues. Iterating...

------
KevanM
The contents links all go back to the top of the page.

~~~
fnwx17
we're currently looking into it to fix it(we're using Github style markdown).
meanwhile, we'll edit it to serve as a table of contents with no links.

~~~
KevanM
Thanks for replying. :)

------
spion
> Lifting is when you take a value and put it into an object like a functor.

It should probably say:

> Lifting is when you take a function and make a version of it that operates
> on functors / applicatives.

~~~
jethrolarson
I don't think this is strictly true. Sure there's liftA2 that does that but as
a general concept, you can lift things of various kinds into a monad (or other
thing like that). For example, `pure`/`return` (`of` in fantasy-land) lifts a
value into an applicative/monad.

I'm not sure if lifting is just application of a coalgebra but I'm still
learning too. :)

~~~
spion
AFAIK lifting is informal and specifically refers to lifting functions.
Confusion arises when this is accomplished via Applicative which... erm
"lifts" currying itself.

------
dualogy
> _" Since these rules govern composition at very abstract level, category
> theory is great at uncovering new ways of composing things."_

I understood this much already prior. What I'd like next now are at least a
handful (half-dozen-or-so) of concrete and truly compelling examples of such
"uncoverings" ;)

OK, 1 or 2 would also be a start

~~~
thedufer
Here's a couple:

Monads are so pervasive that multiple languages have determined that they
deserve special syntax (see: Haskell's do-notation, OCaml's let-syntax). Those
syntaxes play nicely with a ton of seemingly-different types, such as
promises, options (maybes/nullables), lists, monadic error handling (either,
or_error), etc.

On a similar note, recognizing the structure of monads has in the past allowed
me to abstract things in an interesting way. For example, say I have a dict
lookup function (takes a key, returns a value) and I want to build a bunch of
useful functions on top of that. But we want to use them in many different
contexts - the dict might be remote or locally in memory (promises vs. not)
and we may or may not be in a test context (monadic vs exception-based error-
handling). By recognizing that we can just abstract over monads, we can easily
handle these 4 cases (promise, promise+error monad, error monad, unit monad).

~~~
jw-
By OCaml's let syntax do you mean this: [https://blog.janestreet.com/let-
syntax-and-why-you-should-us...](https://blog.janestreet.com/let-syntax-and-
why-you-should-use-it/)?

You can also add F# computation expressions to the list!

~~~
thedufer
Yes, that's what I mean by let syntax. The implementation and more description
can be found at
[https://github.com/janestreet/ppx_let](https://github.com/janestreet/ppx_let)

I failed to find F# computation expressions, probably because I searched for
the word "monad" which they seem to be avoiding, but that's another great
example.

------
moomin
Gotta love it when “Category Theory for Programmers” is provided as a further
reading link on a very introductory article.

~~~
dogruck
Yes. Although I question the usefulness of this jargon list, I think Bartosz
Milewski’s CTfP is excellent:

[https://bartoszmilewski.com/2014/10/28/category-theory-
for-p...](https://bartoszmilewski.com/2014/10/28/category-theory-for-
programmers-the-preface/)

~~~
bitwalker
I bought a physical copy of this recently, it's been great so far, certainly
the best introduction to the topic I've read.

~~~
tommikaikkonen
Where can I order a physical copy?

------
mihau
Does anyone know of similar github repos / websites that describe things (does
not have to be fp) by providing code / math examples ?

~~~
kim031
Professor Frisby's Mostly Adequate Guide to Functional Programming
[https://drboolean.gitbooks.io/mostly-adequate-
guide/](https://drboolean.gitbooks.io/mostly-adequate-guide/)

------
tempodox
Page doesn't display in Kindernet Exploder. All you see is a header and a
footer and no content inbetween.

~~~
fnwx17
We’ll look into it, but can’t promise much as we’re launching a new version
mid December which should be friendlier across more platforms.

------
have_faith
Loved the concise explanations of the What. A nice extension of this would be
the Why, something I usually struggle to understand. Currying as an example,
I'm none the wiser as to why it's a preferable way of composing a function and
it's arguments, or when either is applicable.

~~~
hood_syntax
Let's say you have a validation function that matches a string with a given
regex, and you need to use that same logic in several places, using a
different regex. Currying allows you to write something like this:

validate :: Regex -> String -> T

validate r s = ...

validateIpAddr :: String -> T

validateIpAddr = validate ipRegex

validateZipCode :: String -> T

validateZipCode = validate zipCodeRegex

And so on and so forth. It can reduce boilerplate, and lets you do stuff like
map partially applied functions to functors.

~~~
jandrese
This doesn't really seem to save you much, since you're going from:

    
    
      validate(IpAddr, Regex)
    

to

    
    
      validateIpAddr(Regex)
    

I have to admit I'm a little fuzzy on why currying is desirable so there's
probably something obvious I'm missing.

~~~
taejo
It's `validateIpAddr(String)`: the first argument is fixed. Suppose you have a
list of strings, and you want to extract the ones that are IP addresses. Then
you can just write

    
    
        filter (validate ipRegex) listOfStrings
    

instead of

    
    
        filter validateIpAddr listOfStrings
            where validateIpAddr string = validate ipRegex string

~~~
jandrese
Why not just

    
    
      map { validate(ipRegex, $) } listOfStrings

------
maxpert
It's interesting how simple and understandable now these concepts are with JS.
I couldn't imagine a language written in 7 days ending up with ability to
handle all this.

~~~
morty16
The original JS borrowed heavily from Scheme (lisp1 + everything evaluatable)
and Self (prototype model of inheritance) and then was covered with a bunch of
Java-like nonsense, which (IMO) just made things more complex.

There's been a nice functional language buried in JS all this time. It's still
buried in there someplace.

~~~
zdkl
If you make it through the tooling, clojurescript is magical.

------
zumu
Anyone have any insight as to why they call `bind/flatmap` `chain` instead of
just `flatmap` (given `bind` is already taken in JS)?

~~~
s4vi0r
Presumably because it represents a 'chain' of dependent computations or
something along those lines.

------
kentosi
Really nice.

Small suggestion: It would be really nice if the table of contents allowed me
to click to the section itself.

------
dfabulich
My biggest request would be to add "map" to the list, precisely because it's
ambiguous. It could mean:

1) any key/value data structure

2) a hashmap, specifically

3) a function that runs on each element of an array to make a new array

~~~
rbobrowicz
Those are all just particular cases of the same concept. A "map", well, maps
values in a domain to values in a codomain. A mathematical function is a map.
A key/value data structure can be viewed as a partial function on a non
contiguous, discrete domain. A hashmap is just an implementation detail of a
key/value structure. A map over an array is again just a function mapping an
array in one domain to another array in a codomain.

~~~
skybrian
While that's true in a sense, I think it sweeps important details under the
rug, which confuses things more than it enlightens. You can iterate over the
domain of a map data structure, but not (in general) a map function.

For purposes of education and communication, I think it's unfortunate that we
use the same name for these things.

------
tedmiston
Looks like the article on Works Hub was copied & pasted from the original
source on GitHub, as others have mentioned in subthreads. Would be great if we
could update the article link to the primary source to give the many
contributors credit.

[https://github.com/hemanth/functional-programming-
jargon](https://github.com/hemanth/functional-programming-jargon)

~~~
charliejrgower
the post is linked back to the original source at the bottom of the page.

~~~
tedmiston
Yeah, I saw that and disliked that they copied the entire very long post then
buried the attribution in one small line at the very bottom which most people
will not read to. Without putting that upfront, the site that copied is
playing in a gray area of plagiarism where this is presumed to be original
content from the top of the post.

~~~
charliejrgower
Nice idea - should be moved to the top to avoid confusion. However, all post
are approved by the author before they go live so it's really down to the
writer to structure the post how they wish.

~~~
tedmiston
If you are affiliated with the website that republished, it would be great to
see clearer upfront indication of reposted content.

------
xelxebar
I know this is off topic, but I _really_ wish pages wouldn't hide content
behind JavaScript. The page I see would work just as well as just HTML with a
little CSS styling.

~~~
wruza
[https://github.com/hemanth/functional-programming-
jargon/blo...](https://github.com/hemanth/functional-programming-
jargon/blob/master/readme.md) (it is original article)

In my other deleted comment I thought only links don’t work; but it appears
that you see nothing at all with js off.

~~~
fnwx17
indeed the links to the sections don't work for now and we're looking into it.

regarding the JS stuff, the site is built as an SPA and the blog is only one
feature, the others are job postings and a personal dashboard where a signed-
in user can pin their favorite jobs to keep them for further reference

It's also built using ClojureScript, Reframe, Clojure & GraphQL plus a
revamped version launch is planned for mid-December, so I'm afraid the JS is
still going to be there :)

~~~
wruza
Most of us know what it is built with and what is the point of this submission
on your side, but thanks for the detailed explanation of your fault :)

~~~
fnwx17
haha maybe we did get a bit over zealous with the explanation

~~~
wruza
Yeah, when I was young and I found my comments every second under my forums
posts too, trying to retain the meaning. That looked silly. There is always
something you can learn as you grow up. (No pressure.)

------
alphaalpha101
Correction: Haskell jargon. The continued conflation of Haskell and functional
programming as a whole annoys me greatly. (The majority of functional
programming is not statically typed! Clojure and the other lisps are far more
widely used than Haskell and the MLs, not even to mention that basically every
language has first-class functions now.)

~~~
marcosdumay
"Constant" is a term almost never spoken at Haskell circles, and "referential
transparency" appears much more often within lispers and Clojure practitioners
than between haskellers.

~~~
gmfawcett
It is a stretch to suggest that Haskellers don't discuss referential
transparency as much as Lispers do. It's a fundamentally important concept in
writing and reasoning about Haskell programs.

~~~
marcosdumay
There's a large "fish don't talk about the water" effect. When talking about
Haskell, people talk about referential transparency, but when writing Haskell,
it's very rare.

