Skip to content

Instantly share code, notes, and snippets.

@rexcfnghk
Created May 23, 2019 13:17
Show Gist options
  • Save rexcfnghk/dc429835f60115fb833c502cdb6761d7 to your computer and use it in GitHub Desktop.
Save rexcfnghk/dc429835f60115fb833c502cdb6761d7 to your computer and use it in GitHub Desktop.
atMay :: [a] -> Int -> Maybe a
[] `atMay` _ = None
[x] `atMay` 0 = Just x
(_:xs) `atMay` i = xs `atMay` (i - 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment