I've a hard time understanding a Chess Knight problem concerning function composition. The exercise is a generator/filter/selector chain with a given wrapper function (knightProblem) which glues everything together.
It is unclear to me how the function kGenerator as the first piece in the chain should handle multiple parameters:
-- Chess Knight Problem: Generate all Knight moves of length NrMoves
-- that end at the target position
knightProblem :: StartPos -> NrMoves -> TargetPos -> [Moves]
knightProblem = kSelector . kFilter . kGenerator
-- kGenerator: needs StartPos, NrMoves, generates all sequences of length NrMoves
-- kFilter: remove all moves which contain invalid positions
-- kSelector: keep all moves which terminate at TargetPos
kGenerator :: ???
???
I'm looking for hints on how to handle this kind of problems.
Best regards.