数独を変更して、それがまだ有効かどうかをチェックする小道具を書こうとしています。
ただし、「oneof」関数の正しい使い方がわかりません。ヒントを教えてください。
prop_candidates :: Sudoku -> Bool
prop_candidates su = isSudoku newSu && isOkay newSu
where
newSu = update su aBlank aCandidate
aCandidate = oneof [return x | x <- candidates su aBlank]
aBlank = oneof [return x | x <- (blanks su)]
ここにいくつかの詳細があります...
type Pos = (Int, Int)
update :: Sudoku -> Pos -> Maybe Int -> Sudoku
blanks :: Sudoku -> [Pos]
candidates :: Sudoku -> Pos -> [Int]
[return x | x <- (blanks example)] :: (Monad m) => [m Pos]
私はこの小道具で3時間苦労しているので、どんなアイデアでも大歓迎です!