Functional programming jargon in plain English
1–10 of 191 posts
Re: Functional programming jargon in plain English
#2Even 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
#3Definitely saving this for later.
Re: Functional programming jargon in plain English
#4"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
#5This is great. Finally understand monads a little better. Definitely saving this for later.
Re: Functional programming jargon in plain English
#6This 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?
Re: Functional programming jargon in plain English
#7It’s quite technical even for experienced programmers.
Re: Functional programming jargon in plain English
#8Re: Functional programming jargon in plain English
#9Earlier 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.
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
#10Give 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…