views:

219

answers:

1

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?

+12  A: 

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

qba
Just to highlight it for Mickel: **comma**, not **vertical bar**. Multiple vertical bars are used for parallel list comprehension, which is not what you want (and requires a language extension besides).
ephemient
Thank you guys!
Mickel