diff options
Diffstat (limited to 'h2.hs')
-rw-r--r-- | h2.hs | 11 |
1 files changed, 0 insertions, 11 deletions
@@ -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) |