The zip
function is used to merge two lists in Haskell. It will merge with the elements present at the same position in both lists.
zip list1 list2
It takes two lists as parameters and returns a tuple or list.
Let’s have a look at the example below.
main::IO()main = do--usage of zip functionprint( zip ['x', 'y', 'z'][12, 13, 25] )
zip
function to merge the given two lists. We will pass the given two lists as parameters to the function, and it will return a list after merging the given lists.