Skip to content

Instantly share code, notes, and snippets.

@cronin101
Forked from AngusP/FishBush.hs
Last active August 29, 2015 14:18
Show Gist options
  • Save cronin101/754cd999a5365b29aeed to your computer and use it in GitHub Desktop.
Save cronin101/754cd999a5365b29aeed to your computer and use it in GitHub Desktop.
FishBuush is a monoid under the "shouting something" operator with a unit value of "no fishes".
import Control.Arrow
import Control.Monad
nToFishBuush :: (Show a, Integral a) => a -> String
nToFishBuush n = case ((`rem` 3) &&& (`rem` 5)) n of
(0, 0) -> "FISSSSSHBUSSSHH!"
(0, _) -> "fissshhhhhh"
(_, 0) -> "bUUUUUsh"
_ -> show n
doFishBuushUpto :: (Show a, Integral a) => a -> IO ()
doFishBuushUpto = mapM_ (print . nToFishBuush) . (enumFromTo 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment