nikita-volkov / typeclasses

Explicit typeclasses for Elm
https://package.elm-lang.org/packages/nikita-volkov/typeclasses/latest/
MIT License
54 stars 3 forks source link

what is a monoid #8

Open dullbananas opened 4 years ago

dullbananas commented 4 years ago

the documentation needs to explain what a monoid/semigroup is

nikita-volkov commented 4 years ago

Agreed. Care to PR?

dullbananas commented 4 years ago

no. i dont understand the concept of monoids and semigroups

nikita-volkov commented 4 years ago

Got it.

Until we add the docs I suggest to check out the Haskell or PureScript docs on those concepts:

dullbananas commented 3 years ago

is it basically something that has andThen?

nikita-volkov commented 3 years ago

That would be Monad :)

Monoid is a binary operation (function on two arguments) equipped with identity value (a neutral value in regards to the binary operation). Here's a few examples of practical monoids:

This is an extremely universal abstraction and it allows you to apply the same patterns in composition of seemingly completely unrelated things.