fork download
  1. main :: IO ()
  2. main = do
  3. print $ example [1, 2] [3, 4] (,)
  4. print $ example Nothing (Just 1) (+)
  5. print $ example (Just 2) (Just 3) (*)
  6.  
  7. example :: Monad m => m a -> m a -> (a -> a -> b) -> m b
  8. example mx my f = do
  9. x <- mx
  10. y <- my
  11. pure $ f x y
  12.  
Success #stdin #stdout 0s 4428KB
stdin
Standard input is empty
stdout
[(1,3),(1,4),(2,3),(2,4)]
Nothing
Just 6