You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

33 lines
760 B

  1. -- |
  2. -- Module : HPath.IO.Utils
  3. -- Copyright : © 2016 Julian Ospald
  4. -- License : BSD3
  5. --
  6. -- Maintainer : Julian Ospald <hasufell@posteo.de>
  7. -- Stability : experimental
  8. -- Portability : portable
  9. --
  10. -- Random and general IO/monad utilities.
  11. module HPath.IO.Utils where
  12. import Control.Monad
  13. (
  14. when
  15. , unless
  16. )
  17. -- |If the value of the first argument is True, then execute the action
  18. -- provided in the second argument, otherwise do nothing.
  19. whenM :: Monad m => m Bool -> m () -> m ()
  20. whenM mb a = mb >>= (`when` a)
  21. -- |If the value of the first argument is False, then execute the action
  22. -- provided in the second argument, otherwise do nothing.
  23. unlessM :: Monad m => m Bool -> m () -> m ()
  24. unlessM mb a = mb >>= (`unless` a)