Skip to content

Instantly share code, notes, and snippets.

@osfameron
Created March 28, 2009 01:26
Show Gist options
  • Save osfameron/86995 to your computer and use it in GitHub Desktop.
Save osfameron/86995 to your computer and use it in GitHub Desktop.
import Control.Monad
import Data.Maybe
joinMaybe [] = Nothing
joinMaybe xs = Just $ join xs
fizzbuzz b = fromMaybe (show b)
. joinMaybe
. concatMap (\f -> f b)
$ [aux "fizz" 3, aux "buzz" 5]
where aux s a i = guard ((i `mod` a) == 0) >> return s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment