From 47f5e36f9ce629aa8112a4476ca95688e4b292f5 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Fri, 9 Nov 2007 01:23:46 +0000 Subject: [PATCH] Added another helper function, seqPair, to the Utils module --- common/Utils.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/Utils.hs b/common/Utils.hs index 5966972..ca074a7 100644 --- a/common/Utils.hs +++ b/common/Utils.hs @@ -123,3 +123,9 @@ applyAll x = map (\f -> f x) -- | Like concat applied after mapM (or the monadic version of concatMap). concatMapM :: Monad m => (a -> m [b]) -> [a] -> m [b] concatMapM f x = mapM f x >>* concat + +-- | Like the monadic sequence function, but for pairs instead of lists. +seqPair :: Monad m => (m a, m b) -> m (a,b) +seqPair (x,y) = do x' <- x + y' <- y + return (x',y')