Keep record of previously visited states when searching
问题 I am programming several search functions, for which I use the Node datatype: data Node a = Node { [...] , getPath :: [a] -- ^ Previous states this node has visited } That field, getPath , is what I use to check if I have previously visited that state in that node: when expanding a new node, I check that by doing: visited = `elem` path It works, but it becomes incredibly costly when there are a lot of nodes expanded and the paths become too long. Is there a better way to keep track of the