Skip to content

Comment on Lens: Lenses, Folds and Traversalsparent

Comments

I still don't know what a monoid is though

In short, it's a data type with addition defined. So

"a" + "b" = "ab" <-- string and concat is a monoid

1 + 5 = 6 <-- nat and natural number addition is a monoid

[1] + [2] = [1, 2] <-- list and concat is a monoid

*edit* (it also has a zero defined, such as "" or 0 or [])

Or an applicative

you can think of these as "i'd use a functor here via fmap, except my mapping function takes more than one argument"

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.