Decides if two structures match exactly. If they match, return zipped
version of them.
zipMatch ta tb = Just tab
holds if and only if both of
ta = fmap fst tab
tb = fmap snd tab
holds. Otherwise,
zipMatch ta tb = Nothing.
For example, the type signature of
zipMatch on the list
Functor
[] reads as follows:
zipMatch :: [a] -> [b] -> Maybe [(a,b)]
zipMatch as bs returns
Just (zip as bs) if the
lengths of two given lists are same, and returns
Nothing
otherwise.
Example
>>> zipMatch [1, 2, 3] ['a', 'b', 'c']
Just [(1,'a'),(2,'b'),(3,'c')]
>>> zipMatch [1, 2, 3] ['a', 'b']
Nothing