- | i < 0 = Nothing
- | j < 0 = Nothing
- | k < 0 = Nothing
- | k >= length (cubes g) = Nothing
- | j >= length ((cubes g) !! k) = Nothing
- | i >= length (((cubes g) !! k) !! j) = Nothing
- | otherwise = Just $ (((cubes g) !! k) !! j) !! i
-
-
+ | i < 0 = error "i < 0 in cube_at"
+ | i >= xsize = error "i >= xsize in cube_at"
+ | j < 0 = error "j < 0 in cube_at"
+ | j >= ysize = error "j >= ysize in cube_at"
+ | k < 0 = error "k < 0 in cube_at"
+ | k >= zsize = error "k >= zsize in cube_at"
+ | otherwise = (cubes g) ! (i,j,k)
+ where
+ fvs = function_values g
+ (xsize, ysize, zsize) = dims fvs