diff options
-rw-r--r-- | foo.hs | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1,3 +1,5 @@ +import Data.Maybe (catMaybes) + foo :: [(Int, Int)] foo = [(8, 14), (4,2), (3,4)] @@ -33,4 +35,11 @@ func3 x = x * 5 funcs = [func1, func2, func3] +maybeints = [ Just 1, Just 2, Nothing, Just 4] + +lift_tuple :: (Int, Maybe Int) -> Maybe (Int, Int) +lift_tuple (a, Just b) = Just (a, b) +lift_tuple (a, Nothing) = Nothing + +pairs = catMaybes $ map lift_tuple $ zip intlist maybeints |