I need to analyze the following Haskell function, which is part of a bigger program (extracted from here):
findMoves :: Position -> [Position]
findMoves (left,right) = elems $ Data.Set.filter validPos moves where
moves | Farmer `member` left = Data.Set.map (move delItem addItem) left
| otherwise = Data.Set.map (move addItem delItem) right
move f1 f2 item = (f1 item left, f2 item right)
delItem item = delete Farmer . delete item
addItem item = insert Farmer . insert item
I understand everything until the end of the where
statement, but I haven't seen anything like the move f1 f2 item
declaration before, I'm starting right now with Haskell. What is that? Something like an in-line function declaration? I just need to know which kind of statement is that, I'm not asking you to explain what the developer was trying to do (that's my task).
Thanks