summaryrefslogtreecommitdiff
path: root/h2.hs
diff options
context:
space:
mode:
Diffstat (limited to 'h2.hs')
-rw-r--r--h2.hs11
1 files changed, 0 insertions, 11 deletions
diff --git a/h2.hs b/h2.hs
deleted file mode 100644
index 60693ef..0000000
--- a/h2.hs
+++ /dev/null
@@ -1,11 +0,0 @@
-import Data.Foldable as F
-
-myButLast :: Foldable f => f a -> a
-
-myButLast = fst . F.foldl (\(a,b) x -> (b,x)) (err1, err2)
- where
- err1 = error "Empty list"
- err2 = error "Not enough elements"
-
-mySafeButLast :: Foldable f => f a -> Maybe a
-mySafeButLast = fst . F.foldl (\(a,b) x -> (b,Just x)) (Nothing, Nothing)