-- | safe variant of !!
atMaybe :: [a] -> Int -> Maybe a
atMaybe l i = if i < 0 then Nothing else case l of
  [] -> Nothing
  x : r -> if i == 0 then Just x else atMaybe r (i - 1)
atMaybe :: [a] -> Int -> Maybe a
atMaybe l i = if i < 0 then Nothing else case l of
  [] -> Nothing
  x : r -> if i == 0 then Just x else atMaybe r (i - 1)
atMaybe l i = if i < 0 then Nothing else case l of
  [] -> Nothing
  x : r -> if i == 0 then Just x else atMaybe r (i - 1)