kino/src/Misc.hs

7 lines
118 B
Haskell

module Misc where
(!?) :: [a] -> Int -> Maybe a
[] !? i = Nothing
(x:xs) !? 0 = Just x
(x:xs) !? n = xs !? (n-1)