Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Fizz Buzz Through Monoids (entropicthoughts.com)
5 points by ibobev 29 days ago | hide | past | favorite | 1 comment


> import Control.Monad (guard)

> "fizz" <$ guard (rem i 3 == 0)

I prefer the more transparent

    if i `mod` 3 == 0 then Just "fizz" else Nothing




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: