
All, I ran into a small problem using guards, and I don't really understand what I'm doing wrong. I have this code: ---------------------------------- import Data.List.Split type Cell = Bool data Board = Board [[Cell]] deriving Show trueList = True : trueList createBoard :: Int -> Int -> Board createBoard x y = Board (chunksOf x (take (x * y) trueList)) getCellAt :: Int -> Int -> Board -> Cell getCellAt x y (Board b) | x >= (length b) = False | y >= (length (b !! 0)) = False | otherwise = (b !! x) !! y ----------------------------------- When I try to execute this: getCellAt (-1) 0 $ createBoard 3 3 I get a negative index exception. However, as -1 is smaller than 3 (length of the board), I would expect False to be returned. Am I overlooking something? Thanks! Stijn