-- Parallelism with fixed division of work.
sudoku2 :: [String] -> Eval [Maybe Grid]
sudoku2 puzzles = do
  let (as, bs) = splitAt (length puzzles `div` 2) puzzles
  as' <- rpar (force $ solve <$> as)
  bs' <- rpar (force $ solve <$> bs)
  rseq as'
  rseq bs'
  return (as' ++ bs')


-- Parallelism with dynamic division of work.
sudoku2 :: [String] -> Eval [Maybe Grid]
sudoku2 puzzles = do
  let (as, bs) = splitAt (length puzzles `div` 2) puzzles
  as' <- rpar (force $ solve <$> as)
  bs' <- rpar (force $ solve <$> bs)
  rseq as'
  rseq bs'
  return (as' ++ bs')


-- Parallelism with dynamic division of work.
sudoku2 puzzles = do
  let (as, bs) = splitAt (length puzzles `div` 2) puzzles
  as' <- rpar (force $ solve <$> as)
  bs' <- rpar (force $ solve <$> bs)
  rseq as'
  rseq bs'
  return (as' ++ bs')


-- Parallelism with dynamic division of work.