Add IO modules, previously from HSFM

This commit is contained in:
2016-05-09 16:53:31 +02:00
parent 6638cd8cc1
commit 86a4b9ade2
132 changed files with 3261 additions and 32 deletions

34
src/HPath/IO/Utils.hs Normal file
View File

@@ -0,0 +1,34 @@
-- |
-- Module : HPath.IO.Utils
-- Copyright : © 2016 Julian Ospald
-- License : GPL-2
--
-- Maintainer : Julian Ospald <hasufell@posteo.de>
-- Stability : experimental
-- Portability : portable
--
-- Random and general IO/monad utilities.
{-# OPTIONS_HADDOCK ignore-exports #-}
module HPath.IO.Utils where
import Control.Monad
(
when
, unless
)
-- |If the value of the first argument is True, then execute the action
-- provided in the second argument, otherwise do nothing.
whenM :: Monad m => m Bool -> m () -> m ()
whenM mb a = mb >>= (`when` a)
-- |If the value of the first argument is False, then execute the action
-- provided in the second argument, otherwise do nothing.
unlessM :: Monad m => m Bool -> m () -> m ()
unlessM mb a = mb >>= (`unless` a)