DEV Community

Dmitrii Kovanikov
Dmitrii Kovanikov

Posted on • Edited on

23

Pragmatic Category Theory | Part 2: Composing Semigroups

This article was permanently moved to my personal website:

Top comments (4)

Collapse
 
nunocf profile image
Nuno Ferreira

This is an absolute gem!
I've been working with functional programming for years (Haskell and Elm, and Elixir before) but always struggled with explaining the concept of a semigroup with real, useful examples. I particularly liked your line of explaining that ideas > implementation!
This is incredibly well done and I've already shared this series with a bunch of people.
Really looking forward to read more of these articles :)

Collapse
 
chshersh profile image
Dmitrii Kovanikov

Thanks a lot for your comment! I'm really glad you enjoyed the post!

Collapse
 
bathtub profile image
gank york

Great job!

Just wondering if there are any common utils for Semigroups?

e.g. For Comparable typeclass/trait, I would expect a sort function. Do we have anything like this for Semigroups?

Collapse
 
chshersh profile image
Dmitrii Kovanikov

Great question!

I feel like these sorts of abstractions are not that common in the OCaml world. For example, the sort function for a list just takes a comparator explicitly instead of working with an abstract module:

val sort : ('a -> 'a -> int) -> 'a list -> 'a list
Enter fullscreen mode Exit fullscreen mode

With abstractions like Semigroups they're even less common in the OCaml standard library. I don't think they're popular outside as well (I rarely see them being used). But I'm trying to change this with my series and explain the value of these abstraction 😌

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay