Question

I get the error "Not in scope: x" when doing as follows...

blanks :: Sudoku -> [Pos]
blanks (Sudoku su) = [ fst x | x <- posSud | isBlank (snd x) ]
    where
        isBlank Nothing = True
        isBlank _       = False
        posSud          = zip ixPos (concat su)
        ixPos           = zip ixRows ixCols
        ixCols          = concat (replicate 9 [0..8])
        ixRows          = [floor (x / 9) | x <- [0..81]]

however, if I remove the guard of the 2:nd line GHCI compiles without giving me any errors.

Can you help me understand what I'm doing wrong?

Was it helpful?

Solution

try [ fst x | x <- posSud , isBlank (snd x) ]

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top