To approach your problem from a different direction, I would say that you do not want the function to handle two Maybe [a]. Bear with me:
Basically, the operation you want to do works in two lists to give you a new list, for example
yourFunction :: [a] -> [a] -> [a]
yourFunction a b = ...
, yourFunction . , Maybe [a], : , , . - yourFunction . do, (, yourFunction) ( , ):
playWithMaybe :: Maybe [a] -> Maybe [a] -> Maybe [a]
playWithMaybe maybeA maybeB =
do a <- maybeA -- if A is something, get it; otherwise, pass through Nothing
b <- maybeB -- if B is something, get it; otherwise, pass through Nothing
Just (yourFunction a b) -- both inputs succeeded! do the operation, and return the result
, , , , , (, Maybe, "- ", Either "- " , , ). playWithMaybe, "Maybe -ness" , Just . , Haskell function pure, , , yourFunction, :
playWithMaybe' :: Maybe [a] -> Maybe [a] -> Maybe [a]
playWithMaybe' maybeA maybeB =
do a <- maybeA
b <- maybeB
pure (yourFunction a b)
Haskell , , . :
playWithMonad :: Monad m => m [a] -> m [a] -> m [a]
playWithMonad mA mB =
do a <- mA
b <- mB
pure (yourFunction a b)
- , , , ! ( , , .)
import Control.Applicative
play :: Monad m => m [a] -> m [a] -> m [a]
play mA mB = liftA2 yourFunction mA mB
import Control.Applicative
play' :: Monad m => m [a] -> m [a] -> m [a]
play' = liftA2 yourFunction
Monad Applicative? Monad, , , , , ( pure return ). Learn You a Haskell (http://learnyouahaskell.com/chapters), 11 12. : 11 ! , , Functor Applicative.