Live data from Hacker News

Functional programming jargon in plain English

github.com

1–10 of 191 posts

Re: Functional programming jargon in plain English

#2
Lists like this tend to be a bit overwhelming without context, because a definition can often seem to focus on things that don't make sense if you don't understand the use case, even if you understand the words.

Even if you've read the definition of functor first

> Lifting is when you take a value and put it into an object like a functor. If you lift a function into an Applicative Functor then you can make it work on values that are also in that functor.

Is a pretty rough sentence for someone not familiar. I think Elm does a pretty good job of exposing functional features without falling into using these terms for them, and by simplifying it all.

It does pay for that in terms of missing a lot of the more powerful functional features in the name of keeping it simple, but I do think it makes it a great entry-point to get the basics, especially with how good the errors are, which is very valuable when you are learning.

I know it's a controversial language on HN to some extent (I certainly have my own issues with it shakes fist at CSS custom properties issue), but I genuinely think it's a great inroad to functional programming.

Re: Functional programming jargon in plain English

#4
These definitions don't really give you the idea, rather often just code examples..

"The ideas", in my view:

Monoid = units that can be joined together

Functor = context for running a single-input function

Applicative = context for multi-input functions

Monad = context for sequence-dependent operations

Lifting = converting from one context to another

Sum type = something is either A or B or C..

Product type = a record = something is both A and B and C

Partial application = defaulting an argument to a function

Currying = passing some arguments later = rephrasing a function to return a functions of n-1 arguments when given 1, st. the final function will compute the desired result

EDIT: Context = compiler information that changes how the program will be interpreted (, executed, compiled,...)

Eg., context = run in the future, run across a list, redirect the i/o, ...

Re: Functional programming jargon in plain English

#6
post #5
post #3

This is great. Finally understand monads a little better. Definitely saving this for later.

Why do monads come up so often when people talk about FP? Is it a meme or are they really an important and difficult to understand concept?

Haskell uses monads as an escape hatch for performing side effects, so they come up often there.

Re: Functional programming jargon in plain English

#9
post #6
post #5

Earlier quoted context omitted.

Why do monads come up so often when people talk about FP? Is it a meme or are they really an important and difficult to understand concept?

Haskell uses monads as an escape hatch for performing side effects, so they come up often there.

Not as an "escape hatch" (that would be something more like `unsafePerformIO :: IO a -> a`), but as a principled way to compose (among other things) IO actions.

A Haskell program executes the IO action at `Main.main`, which must have type `IO ()`.

`putStrLn :: String -> IO ()` is a pure function - if you give it the same input, it always the same IO action as a result.

Re: Functional programming jargon in plain English

#10
All these niche functional programming languages are an exercise in pseudo intellectualism

Give me an object oriented language any day. The world is made of state and processes, (modern niche) functional programming goes too far to derecognise the value of state in our mental models

The good thing about functional programming is stressing to avoid side effects in most of the code and keep it localised in certain places…

Post reply on HN