This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Repeater where | |
| -- General usable module that repeats any IO action n times. | |
| -- by Niko Heikkilä | |
| repeatIOAction :: Int -> IO () -> IO () -- Inputs: integer and IO. Outputs: IO | |
| repeatIOAction 0 _ = return () -- exit recursive loop here | |
| repeatIOAction n action = do | |
| action -- action to perform | |
| repeatIOAction (n-1) action -- decrement n to make it recursive |