haskell.

preview_player
Показать описание
I tried to learn Haskell. I tried to be a good boy and learn the way of functional programming. But what the func is happening. What's the deal with Haskell? Why? Monoids?

🏫 COURSES 🏫

🔥🔥🔥 SOCIALS 🔥🔥🔥
Рекомендации по теме
Комментарии
Автор

Every Haskell tutorial:
Lesson 1: To add 2 numbers, use "+". Easy!
Lesson 2: To concatenate two lists, use "++". Easy!
Lesson 3: So to do I/O the only thing you really need to understand is that a monoid is simply a noncomposable convex bijection into inverse functor space. In other words it is a mapping over types. This allows you to

charleshawkins
Автор

"foldr mappend mempty" is exactly how this makes me feel

LunarSoul
Автор

What you get when a computer scientist is married to a software engineer but the milkman is a category theorist 👀

austinbutts
Автор

Haskell fanboy here and I've been laughing hysterically for 2 minutes straight.

LeRoyDecapite
Автор

A nice mental excercise is to come up with a type system where types share as much common typeclasses as possible. This is how you get Semigroup (anything that can concat), Monoid (Semigroup + a way to concat an empty value), Foldable (fold, a.k.a. reduce), etc.. Typeclass names sound complicated, but it gets easier once you can understand the meaning behind it.

ivanjermakov
Автор

Wait until you see the APL guy pull out his special keyboard

PSPCDJ
Автор

Everyone's having fun until the functional languages arrive

apollowellstein
Автор

I love the little jokes that you add into the videos. They don't go unnoticed. "How do I escape VIM" as the default search. Love it. Been in EE/CS/Linux for many years and the joke never gets old. There's always a Grad or something asking! :)

mgeo
Автор

I've glanced over at Haskel a few times now but I still think I'm fine with C...

konnilol
Автор

God looks away when one programs in Haskell

officialbfi
Автор

Your synopsis is 100% correct. I haven't had to touch Haskell in > 20 years and its still giving me nightmares!

Dust
Автор

If you haven’t learned Haskell or another functional language I highly recommend. I was taught in university and at first I was lost but once it clicks it becomes fun. You start to notice how your brain thinks differently as you slowly go into flow.

brandonc
Автор

This is how I understand it: A Monoid sometimes called a Combinator in F# is a datatype that can be combined/concatenated. This is usually done on a collection such as a list or in your case a tree. Without using loops you have 2 choices either sum the tree recursively, or use the more elegant method by using a fold. Fold applies a binary function such as plus operator between all elements of the Monoid. So applying fold on + function on the list [1, 2, 3] it sticks the plus in between the values and calculates a result. Concatenating a string is also an example taking a list of strings and adding them together to form a larger string. So it's sort of like anything that is a collection that can be reduced to a single value. Another frequent operation of folds are checking if a list has "any of", "none of", or "all of" a certain element. So for instance fold (==5) [1, 2, 3, 4, 5] will result in the value false since not all values are 5. This is a somewhat simplified version. In a short sentence a Monoid is a collection that can be reduced to a single value(simplified version). Btw use F# instead of Haskell is my advice to everyone if you want to stay sane, Cabal will take 10 years off your life :-D

torarinvik
Автор

haskel is built around pure maths and theory in more mathematical stuff. If you don't have the foundation and that already then you're just going to be very confused. Unlike other languages, instead of it being based off of the foundations of more of a literal Hardware aspect of computer science this is mostly very high-level theory of computer science. It's not that it's a dumb or bad language it's just that it's very foreign to most people who don't already have the foundation in theoretical mathematics. It's a very fascinating and very interesting topic if you decide to do a deep dive. I'm not very good at it, but personally I think it is very cool

zilog
Автор

EDIT 2: Please read my whole comment. I keep getting replies about functional programming. This comment is not about functional programming, as I already added at the bottom.

My main gripe with Haskell is just that... you can tell it was made by mathematicians, not by IT people, bringing along design philosophies that make sense in math, but probably not as much in a programming languages, like optimizing for fast writing, not fast reading of code

EDIT: Just to be clear: I'm talking about Haskell as a language and its syntax. Not about functional programming.

SkyyySi
Автор

I was so lost just watching this minute

billigerfusel
Автор

Funnily enough I found Haskell quite straightforward from the beginning and I wrote my first "useful" project using it and I am like 3 weeks into the language.

I really recommend everyone to do a paradigm switch it teaches you a lot. It doesn't have to be Haskell if you're not comfortable with it maybe consider trying ocaml, elixir, scala or even F#. Just break your norm.

khengari
Автор

Your explanations are so concise and easy to follow😀. Thank you for making this video!

MyCodingDiary
Автор

it helps to look at the math definitions for this kind of stuff, because that's what haskell and related languages are based on. a monoid is just a semigroup equipped with an identity element, and a semigroup is a set of elements with a closed "combination" operation defined over the set. you could take the set of natural numbers and form a semigroup where the operation is simple addition. to extend it to a monoid, define the identity element to be zero, because n + 0 = n. You could instead define a semigroup over the natural numbers that uses multiplication, and the identity element is 1. In this "assignment" the natural semigroup operation would be to create a new node and install both operands as its children, and the identity element would be an empty tree.

harleyspeedthrust
Автор

Monoids are a useful concept in programming indepently of Haskell. For example: if an operation is a monoid (hence associative) then it can more efficiently evaluated in parallel but performing the computation as a tree instead of sequentially.

pedrovasconcelos