Haskell standard function (or simple composition) for "mjoin"? -


this seems long shot, i've had need following:

mjoin :: (monoid b, monad m) => m b -> m b -> m b mjoin b =   a' <-   b' <- b   return $ mappend a' b' 

the example use this:

> mjoin (just [1,2,3]) (just [4, 5, 6]) [1,2,3,4,5,6] > mjoin (just [1,2,3]) nothing nothing > mjoin nothing (just [4, 5, 6]) nothing 

in other words, if either parameters nothing, return nothing. else, return just , appended values.

is there standard function or simpler formulation, perhaps >>=?

perhaps this:

mjoin :: (monoid b, monad m) => m b -> m b -> m b mjoin = liftm2 mappend 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -