I have a problem with a haskell program. I want to do something like this:
main = do
print $ map foo [(1, [(2, 3), (4,5)])]
foo :: (Int, [(Int, Int)]) ->
(a, [(b, c)])
does not match (1, [(2, 3), (4, 5)])
, because the list in the latter has two elements while your pattern requires there to be only one.
If you want to leave the list unchanged, use this pattern instead:
foo (a, bar) = (a+1, bar)
Now bar
will match [(2, 3), (4, 5)]
because it is just a binding which will match anything of the correct type.