It contains only one MonadPlus-specific function and we would like
to add more Monad-specific functions.
---
 Makefile.am                   |  2 +-
 src/Ganeti/Query/Exec.hs      |  2 +-
 src/Ganeti/Utils/Monad.hs     | 51 +++++++++++++++++++++++++++++++++++++++++++
 src/Ganeti/Utils/MonadPlus.hs | 51 -------------------------------------------
 src/Ganeti/WConfd/TempRes.hs  |  2 +-
 5 files changed, 54 insertions(+), 54 deletions(-)
 create mode 100644 src/Ganeti/Utils/Monad.hs
 delete mode 100644 src/Ganeti/Utils/MonadPlus.hs

diff --git a/Makefile.am b/Makefile.am
index fd9f29e..193c3ce 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -909,7 +909,7 @@ HS_LIB_SRCS = \
        src/Ganeti/Utils/AsyncWorker.hs \
        src/Ganeti/Utils/IORef.hs \
        src/Ganeti/Utils/Livelock.hs \
-       src/Ganeti/Utils/MonadPlus.hs \
+       src/Ganeti/Utils/Monad.hs \
        src/Ganeti/Utils/MultiMap.hs \
        src/Ganeti/Utils/MVarLock.hs \
        src/Ganeti/Utils/Random.hs \
diff --git a/src/Ganeti/Query/Exec.hs b/src/Ganeti/Query/Exec.hs
index 81373ba..14faee0 100644
--- a/src/Ganeti/Query/Exec.hs
+++ b/src/Ganeti/Query/Exec.hs
@@ -88,7 +88,7 @@ import qualified Ganeti.Path as P
 import Ganeti.Types
 import Ganeti.UDSServer
 import Ganeti.Utils
-import Ganeti.Utils.MonadPlus
+import Ganeti.Utils.Monad
 import Ganeti.Utils.Random (delayRandom)
 
 isForkSupported :: IO Bool
diff --git a/src/Ganeti/Utils/Monad.hs b/src/Ganeti/Utils/Monad.hs
new file mode 100644
index 0000000..23df5bd
--- /dev/null
+++ b/src/Ganeti/Utils/Monad.hs
@@ -0,0 +1,51 @@
+{-| Utility functions for MonadPlus operations
+
+-}
+
+{-
+
+Copyright (C) 2014 Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+1. Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-}
+
+module Ganeti.Utils.Monad
+  ( mretryN
+  , retryMaybeN
+  ) where
+
+import Control.Monad
+import Control.Monad.Trans.Maybe
+
+-- | Retries the given action up to @n@ times.
+-- The action signals failure by 'mzero'.
+mretryN :: (MonadPlus m) => Int -> (Int -> m a) -> m a
+mretryN n = msum . flip map [1..n]
+
+-- | Retries the given action up to @n@ times.
+-- The action signals failure by 'mzero'.
+retryMaybeN :: (Monad m) => Int -> (Int -> MaybeT m a) -> m (Maybe a)
+retryMaybeN = (runMaybeT .) . mretryN
diff --git a/src/Ganeti/Utils/MonadPlus.hs b/src/Ganeti/Utils/MonadPlus.hs
deleted file mode 100644
index 3596d95..0000000
--- a/src/Ganeti/Utils/MonadPlus.hs
+++ /dev/null
@@ -1,51 +0,0 @@
-{-| Utility functions for MonadPlus operations
-
--}
-
-{-
-
-Copyright (C) 2014 Google Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-1. Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--}
-
-module Ganeti.Utils.MonadPlus
-  ( mretryN
-  , retryMaybeN
-  ) where
-
-import Control.Monad
-import Control.Monad.Trans.Maybe
-
--- | Retries the given action up to @n@ times.
--- The action signals failure by 'mzero'.
-mretryN :: (MonadPlus m) => Int -> (Int -> m a) -> m a
-mretryN n = msum . flip map [1..n]
-
--- | Retries the given action up to @n@ times.
--- The action signals failure by 'mzero'.
-retryMaybeN :: (Monad m) => Int -> (Int -> MaybeT m a) -> m (Maybe a)
-retryMaybeN = (runMaybeT .) . mretryN
diff --git a/src/Ganeti/WConfd/TempRes.hs b/src/Ganeti/WConfd/TempRes.hs
index 65654da..020aee8 100644
--- a/src/Ganeti/WConfd/TempRes.hs
+++ b/src/Ganeti/WConfd/TempRes.hs
@@ -99,7 +99,7 @@ import Ganeti.Objects
 import Ganeti.THH
 import Ganeti.Objects.Lens (configNetworksL)
 import Ganeti.Utils
-import Ganeti.Utils.MonadPlus
+import Ganeti.Utils.Monad
 import Ganeti.Utils.Random
 import qualified Ganeti.Utils.MultiMap as MM
 
-- 
2.1.0.rc2.206.gedb03e5

Reply via email to