this post was submitted on 17 Aug 2025
569 points (99.3% liked)

Programmer Humor

25773 readers
2022 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] expr@programming.dev 4 points 1 day ago* (last edited 22 hours ago)

It looks pretty normal to me as a professional Haskeller, though I suppose it's perhaps slightly cleaner to write it as conditionalBaptize p = fromMaybe p $ baptize p. It's largely just a matter of taste and I'd accept either version when reviewing an MR.

Edit: I just thought of another version that actually is far too clever and shouldn't be used:

conditionalBaptize = ap fromMaybe baptize, making use of the monad instance for ->. But yeah, don't do this.