title: Backtrack sudoku in haskell
body: <p>I'm trying to build a backtrack sudoku solver in Haskell. But I'm stuck at one of the final points. I created a function called nextBoards which returns all possible soduko boards where the next empty place is filled in with the possible values. Now I'm trying to use backtracking in Haskell, but I cannot use things like while-loops and now I'm really confused on how to do this. I've made a sudoku solver before in Java, but I'm completely stuck on how to do it in Haskell for the moment.</p>
  
  <pre><code>-- Generate the next boards for a given board
  nextBoards :: Board -&gt; [Board]
  nextBoards b = 
      let position = findFirstEmpty b
      in [update z (snd position) (fst position) b | z &lt;- options b (snd position) (fst position)]
  
  -- We found the real solution
  solve :: Board -&gt; [Board] -&gt; Board
  solve focus options
      | not (notEmpty focus) = focus
  -- We hit a dead path try the next option
  solve focus options
      | solve (head options) (tail options)
  -- We are solving the focus, generate the next boards
  -- and save the rest in the options
  solve focus options
      | solve (head (nextBoards focus)) (tail (nextBoards focus))
  </code></pre>
  
  <p>I really don't know on how to proceed.</p>