summaryrefslogtreecommitdiffstats
path: root/src/Data/List/Extra.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/List/Extra.hs')
-rw-r--r--src/Data/List/Extra.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Data/List/Extra.hs b/src/Data/List/Extra.hs
new file mode 100644
index 0000000..d18bc76
--- /dev/null
+++ b/src/Data/List/Extra.hs
@@ -0,0 +1,8 @@
+module Data.List.Extra where
+
+import Data.Maybe (listToMaybe)
+
+
+(!!?) :: [a] -> Int -> Maybe a
+x !!? i | i >= 0 = listToMaybe (drop i x)
+_ !!? _ = Nothing