Skip to content

Instantly share code, notes, and snippets.

@tarquin-the-brave
Created May 12, 2020 13:36
Show Gist options
  • Save tarquin-the-brave/0c1aee5649f59988f44b4ca337d72b27 to your computer and use it in GitHub Desktop.
Save tarquin-the-brave/0c1aee5649f59988f44b4ca337d72b27 to your computer and use it in GitHub Desktop.
(!!!) :: Integral a => [a] -> Int -> Maybe a
infixl 9 !!!
xs !!! i
| i < 0 = Nothing
| i >= length xs = Just 0
| otherwise = Just $ xs !! i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment