Good day!
So I am trying to write a function is Haskell as follows
remove_nulls :: [ ([String], Int) ] -> [ ([String], Int) ] -> [ ([String], Int) ]
remove_nulls listofpair (y:ys)
| null listofpair = (y:ys)
| null (fst(head listofpair))= remove_nulls (tail listofpair) (y:ys)
| otherwise = remove_nulls (tail listofpair) (y:(head listofpair):ys)
Which takes an input that may looks like this
remove_nulls [ ([],0) , (["abc", "dce"], 2) ] []
The idea is that it will remove the tuple from the list if it contains a null in its first value. However, every time I call it it returns "Non-exhaustive patterns in function remove_nulls".
I've tried changing the base case but I always get the same result. Any help and exploitation would be great (currently just learning Haskell).