Why is haskell throwing this error?
Trying to write a function that enumerates the elements of a list and returns a list of tuples with numbers, I know I can do this with the "zip" function, but the challenge is to write it recursively: so I get
cannot construct an infinite type: a = [a] when the generic type for the numerator '
What am I doing wrong?
numerize' :: [a] -> Int -> [(a, Int)]
numerize' [] _ = []
numerize' [x] n = [(x, n)]
numerize' [x:xs] n = (x, n) : numerize' xs (n + 1)
+3
source to share