Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. unzipPairs :: [(a, b)] -> ([a], [b])
  2. unzipPairs list = foldl (\(l1, l2) (c, d) -> (l1 ++ c, l2 ++ d)) ([], []) list
  3.  
  4.  
  5. main.hs:2:75: error:
  6. • Occurs check: cannot construct the infinite type: a ~ [a]
  7. Expected type: [([a], [b])]
  8. Actual type: [(a, b)]
  9. • In the third argument of ‘foldl’, namely ‘list’
  10. In the expression:
  11. foldl (\ (l1, l2) (c, d) -> (l1 ++ c, l2 ++ d)) ([], []) list
  12. In an equation for ‘unzipPairs’:
  13. unzipPairs list
  14. = foldl (\ (l1, l2) (c, d) -> (l1 ++ c, l2 ++ d)) ([], []) list
  15. • Relevant bindings include
  16. list :: [(a, b)] (bound at main.hs:2:12)
  17. unzipPairs :: [(a, b)] -> ([a], [b]) (bound at main.hs:2:1)
  18. |
  19. 2 | unzipPairs list = foldl (\(l1, l2) (c, d) -> (l1 ++ c, l2 ++ d)) ([], []) list
  20. |
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement