How Monoids are useful in Programming?

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

I THINK FORBIDDING LOWERCASE CHARACTERS WOULD BE A GREAT RESTRICTION.

badwolf
Автор

Now that's a epic haskell programming video

red_reaper
Автор

I have shown this video to my React codebase. It turned into Elm

valigotech
Автор

Whenever he says "what do I need for that?" The answer is always a function

joriskbos
Автор

"that looks like something and average javascript programmer would write and is extremely lame"


lmfao this is why I watch your videos (oh and yeah I work with JS for a living)

gillchristiang
Автор

following the logical sequence of your thought to arrive at the final composite function of all predicates using monoids was amazing, very enlightening so thanks a lot :)
!

LeoOno
Автор

You could just create a function "f = (or .) . sequence"
This is a function that when given a list of functions of type [Char -> Bool] it returns a single function of type Char -> Bool.
This uses Monads by pulling "Char ->" outside of the list and returning a list of [Bool], which then uses "or" to see if one is true.
Or, to get it all in one line:
isForbidden = or . sequence [isBraille, isDigit, isUpper]

BryceTheGrand
Автор

If I ever pickup haskell, I saved this video since it's the fastest whirlwind tour of almost every aspect of the language environment 😂 -- in under 10 minutes!

help system, errors, composition, libraries, it's got it all

MrRedstonefreedom
Автор

I knew about such a powerful tool as monoids before but I didn't know that any function that returns a monoid is also a monoid and it can be used in a very predictable way. Thank you.

fakt
Автор

*isForbidden c = any ($c) [ isEmoji, isBraille ]*

I don't like importing lesser known functions when the alternative is just as concise.

WilcoVerhoef
Автор

This is so bizarre he changed his tune so much

nevokrien
Автор

More Haskell videos, they are so epic!

СергейКузнецов-вюш
Автор

I used to Haskell but than I took a python to the knee.

japrogramer
Автор

Why the hassle with importing stuff?

isForbidden c = any $ map ($ c) [isBraille, isEmoji]

smuecke
Автор

I've been learning a lot from you! Your videos are great! Congrats! 👏👏👏

robertodantas
Автор

These are the best Haskell tutorials I've seen!

jamma
Автор

Apart from the other nice solutions or variations that have been outlined here in the comments, I wanted to mention that there is no need to fmap a newtype data constructor just to satisfy the type checker, given that newtypes are a no-op at runtime. All newtype instances are coercible with their underlying type, so you should be able to use the ```coerce``` function from Data.Coercible to turn them into Any or All with no runtime cost.

You probably need some type signature to clarify which instance to coerce into. Something like ```(coerce :: [a -> Bool] -> [a -> Any])``` or better yet
```isForbidden = getAny . (fold $ coerce predicates :: Char -> Any) where ...```

Tomyb
Автор

I think the "m" in "mempty", "mappend", and "mconcat" stands for "M"onoid

AndrewBrownK
Автор

Cool, i get so excited when you post haskell content

aBamieh
Автор

i like how there's an efficient solution 1:25 into the video but it's scrapped for epic haskell hubris

danielsmith