'Filter separate csv files in Haskell by column?

I'm learning Haskell and have been having difficulties with creating functions that parse csv files and filter them. I want to write a function(or multiple functions) that take in 2 csv files and compares them to filter out a list of words in the first csv file.

Example CSV file 1 has:

ID,State,Desc
1,"Solid",Something
2,"Liquid",Something
4,"Gas",Something 

And CSV file 2 has:

State,Desc,ID
" Not Solid",Something,1
"Plasma",Something,3
"Matter",Something ,5

Is it possible to compare the State column from the first csv file with the State column of the second csv file and filter them out so that if a word inside csv2 matches a word inside csv1 then it can be removed so the final output would look something like:

ID,State,Desc
2,"Liquid",Something
4,"Gas",Something 

I've been able to return the columns for each csv file separately but have been unable to save them in Haskell to do the filter later. I was also thinking of hard coding the State column from the second csv file but have had no luck with the function

remove :: [Record] -> IO()
 remove csv =  print $ filter (not.any (`elem` csv2)) csv
     where csv2 = ["Not Solid", "Plasma", "Matter"]

There are not a ton of csv parsing/processing tips with Haskell so any help would be greatly appreciated!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source