getAt :: [String] -> Number -> Number -> String getAt strings x y = case strings !! y of Nothing -> " " Just line -> case charAt x line of Nothing -> " " Just char -> fromChar char -- getAt ["abc", "def"] 0 1 -- returns "d"
It retrieves a character at position (x, y) from a "grid" of characters given as an arrays of strings. I can't help but think that the same function would be just
Maybe, but can I at least write this in a more concise way?