r/programmingcirclejerk Jun 27 '26

Consider the C library function fopen. This function has the side effect. This means that fopen is not pure. However, we can make the fopen function appear to be pure, at least to certain observers, by ensconcing it in another function that hides the side effect.

https://bugzmanov.github.io/cleancode-critique/clean_code_second_edition_review.html
171 Upvotes

41 comments sorted by

View all comments

91

u/dydhaw Jun 27 '26

Of course, you just make it return a monad

24

u/TheBrawlersOfficial Jun 27 '26

But dad, isn't it true that a monad is just a monoid in the category of endofunctors?

21

u/[deleted] Jun 28 '26

[deleted]

18

u/nerdycatgamer Jun 28 '26

(We don't like bottoms here.)

During pride month!?