checkDim' :: Index -> (Index, a) -> (Index, a)
checkDim' d (i, v) | i < 1 || i > d = error $ "Index out of bounds (" ++ show i ++ " not in (1," ++ show d ++ "))"
                   | otherwise = (i, v)
checkDim' :: Index -> (Index, a) -> (Index, a)
checkDim' d (i, v) | i < 1 || i > d = error $ "Index out of bounds (" ++ show i ++ " not in (1," ++ show d ++ "))"
                   | otherwise = (i, v)
checkDim' d (i, v) | i < 1 || i > d = error $ "Index out of bounds (" ++ show i ++ " not in (1," ++ show d ++ "))"
                   | otherwise = (i, v)