packages feed

strict-list 0.1.1 → 0.1.2

raw patch · 2 files changed

+10/−4 lines, 2 files

Files

library/StrictList.hs view
@@ -176,12 +176,18 @@ >span predicate list = (takeWhile predicate list, dropWhile predicate list) -} span :: (a -> Bool) -> List a -> (List a, List a)-span predicate = let+span predicate = first reverse . spanReversed predicate++{-|+Same as `span`, only with the first list in reverse order.+-}+spanReversed :: (a -> Bool) -> List a -> (List a, List a)+spanReversed predicate = let   buildPrefix !prefix = \ case     Cons head tail -> if predicate head       then buildPrefix (Cons head prefix) tail-      else (reverse prefix, Cons head tail)-    _ -> (reverse prefix, Nil)+      else (prefix, Cons head tail)+    _ -> (prefix, Nil)   in buildPrefix Nil  {-|
strict-list.cabal view
@@ -1,5 +1,5 @@ name: strict-list-version: 0.1.1+version: 0.1.2 synopsis: Strict linked list description:   Implementation of strict linked list with care taken about stack.