Added a few more helper functions to the Utils module
This commit is contained in:
parent
d2b427c268
commit
86b8185b1f
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user