4 ms·
Hmm. They certainly have a naming and explanation problem in Haskell land. Some impressions from a few of these better explanations. "A monad is composed of th
by nickpsecurity 10y ago
Hmm. They certainly have a naming and explanation problem in Haskell land. Some impressions from a few of these better explanations.
"A monad is composed of three functions and encodes control flow which allows pure functions to be strung together."
Gibberish compared to claim that monads just execute functions in a specified order. Aka an imperative function or procedure by one definition I've seen a lot. Of course, that monad definition might be wrong, too.
"A recursive function is a function that calls itself inside its own definition."
That's a recursive definition lol. Must have been a joke.
"A monad transformer allows you to stack more than one monad for use in a function."
We've had composition of procedures for a long time. Perhaps Haskell could've called it a MonadComposer?
"Lift is an operation on a functor that uses fmap to operate on the data contained in the functor."
fmap-apply() or something like that?
"Optics(lens and prisms) allow you to get and set data in a data type."
Getters and setters. My early OOP/C++ books are finally more intuitive than something.
"Map applies a function to every element of a list."
foreach(function(), list)
"A predicate is a function that returns true or false."
A boolean function.
"Filter applies a predicate to a list and returns only elements which return true."
Syntactic sugar for a foreach(function, list()) where the function on each member is an If (Conditional) is TRUE Then AddElementToNewListThatsReturned(). Yeah, even the description of imperative version is getting long. This might be a productivity boost.
"A morphism is a transformation from any object to any other object."
A cast from one object to another? Or one with an actual conversion function and/or check? The functional name seems more accurate, though.
"Algebraic data types are a method to describe the structure of types."
Ahh, they're just structs. Wait, what is a type exactly? And therefore what is an abstract... oh darn...
"Free monads allow the transformation of functors to monads."
A functor is an object that can be fmaped over. We covered map. Maybe the same. A monad is either an ordering of functions or something composed of three functions and encodes control flow composed of pure functions. Free monads are apparently an unknown thing that can transform objects that can be fmaped over into something composed of three functions with encoded control flow of composed, pure functions. I heard a lot of good Masters and Ph.D. proposals before this one. This is good, though. Especially quantifying the unknown aspects with a lot of NSF-funded R&D.
"A lambda is an unnamed function."
"Types are an inherent characteristic of every Haskell expression."
"Currying uses partial application to return a function until all arguments are filled."
"A category is a collection of objects, morphisms, and the configuration of the morphisms."
Ok, I just have fun with that one. Author did good on a lot of them. I'm just going to leave these here as quotes to add to Free Monads in... The Advanced Course: Haskell in Two or More Sentences. They provide anywhere from no information at all to the uninitiated to extra confusion inspiring taking or avoiding Haskell courses. :)
- seagreen 10y ago> My early OOP/C++ books are finally more intuitive than something. Ouch! But seriously, this page is just a someone's jotted out notes. Haskell Programming from First Principles and What I Wish I Knew When Learning Haskell (http://dev.stephendiehl.com/hask/ http://dev.stephendiehl.com/hask/) are the actual pinnacle of Haskell explanations. They have plenty of great examples.
- nickpsecurity 10y agoIt's a quick impression and in jest. Don't take it too seriously. ;) I respect that the author is making an attempt to simplify these things. Thanks for the recommendations.
- m-j-fox 10y agoI get why you think that, but the names are actually precise in the way that terminology in an academic paper is precise. It's just not helpful to outsiders. It's arguably pretentious to draw on category theory to describe types and functions but that's academia for you. Haskell has become the language that academia built, for better or worse. Maybe that's a shame. Take fmap, functor-map, for example. It's just map if you apply it to a List. But it's more general. You can apply it to a Tree or a List of Lists or any other Functor. They could have called Functor a Bag or a Box or a Container or a Listable. They could have called it an Fmapable, since Fmapable is the class of things fmap works on. Might have missed an opportunity. Or take the monadic bind operator >>=. Another language calls it and_then. I can see how that's more friendly.
- Smaug123 10y ago> "A predicate is a function that returns true or false." > A boolean function. Come now, you're not allowed to complain both that the names are confusing, and also that more terminology should be used.
- nickpsecurity 10y agoAlmost every programmer will have learned what a boolean condition is. Hence me bringing it up as a default explanation for something that's true or false. "It's a conditional like what you evaluate in an If-Then statement." "Oh yeah, I see what you're saying."