diff --git a/common/FlowGraphTest.hs b/common/FlowGraphTest.hs index fc74b24..d4fe595 100644 --- a/common/FlowGraphTest.hs +++ b/common/FlowGraphTest.hs @@ -401,7 +401,6 @@ genList :: (Int -> GenL a) -> Int -> GenL [a] genList _ 0 = return [([],[])] genList f n = (lift $ genNumsToTotal n) >>= mapM f >>= foldList where - singleton x = [x] foldList :: [[([Meta], a)]] -> StateT Id Gen [([Meta], [a])] foldList [g] = comb1 singleton (return g) foldList gs = return $ foldr foldX [] gs diff --git a/common/Utils.hs b/common/Utils.hs index c0cbd56..565c669 100644 --- a/common/Utils.hs +++ b/common/Utils.hs @@ -275,3 +275,12 @@ showListCustom showFunc list = "[" ++ concat (intersperse "," (map showFunc list showPairCustom :: (a -> String) -> (b -> String) -> (a,b) -> String showPairCustom showA showB (a,b) = "(" ++ showA a ++ "," ++ showB b ++ ")" + +singleton :: a -> [a] +singleton x = [x] + +applyPair :: (a -> b) -> (a,a) -> (b,b) +applyPair f = transformPair f f + +applyPairM :: Monad m => (a -> m b) -> (a,a) -> m (b,b) +applyPairM f = seqPair . transformPair f f