Maybe getting a character from a list of strings I'm trying to transition from JavaScript to PureScript (a Haskell spinoff that transpiles to JavaScript). For starters I coded this:

getAt :: [String] -&gt; Number -&gt; Number -&gt; String
getAt strings x y = case strings !! y of
    Nothing -&gt; " "
    Just line -&gt; case charAt x line of
        Nothing -&gt; " "
        Just char -&gt; 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 return strings[y][x] in JavaScript assuming that (x, y) are always within bounds - which is true in my case. I can't get rid of these functions that return Maybe, but can I at least write this in a more concise way?
I haven't used PureScript, but in Haskell the most straightforward way to do this would be to leverage the Monad instance for Maybe and write your function using do-notation. From toying around with http://try.purescript.org/ I think this should work.

getAt :: [String] -&gt; Number -&gt; Number -&gt; String
getAt strings x y = fromMaybe " " $ do line &lt;- strings !! y
                                       char &lt;- charAt x line
                                       return $ fromChar char


Note the use of fromMaybe, after you've done your computation in the Maybe monad, you get back out by specifying a "default" to use in the case that any value of Nothing cropped up, causing the whole do-block to return Nothing.