Zora 1.1.22 → 1.1.23
raw patch · 3 files changed
+34/−7 lines, 3 filesdep +ZoraPVP ok
version bump matches the API change (PVP)
Dependencies added: Zora
API changes (from Hackage documentation)
Files
- Tests/test-zora.hs +21/−0
- Zora.cabal +8/−2
- Zora/List.hs +5/−5
+ Tests/test-zora.hs view
@@ -0,0 +1,21 @@+{-# LANGUAGE ScopedTypeVariables #-}++module Main (main) where++-- imports++import Test.Tasty+import Test.Tasty.HUnit++import qualified Zora.List as ZL++testTakeWhileAndLast :: Assertion+testTakeWhileAndLast = do+ 1 @?= 2++tests :: TestTree+tests = testGroup "unit tests"+ [ testCase "Testing `testTakeWhileAndLast`" testTakeWhileAndLast ]++main :: IO ()+main = defaultMain tests
Zora.cabal view
@@ -1,9 +1,9 @@ Name: Zora-Version: 1.1.22+Version: 1.1.23 Synopsis: Graphing library wrapper + assorted useful functions Description: A library of assorted useful functions for working with lists, doing mathematical operations and graphing custom data types. Category: Unclassified-Cabal-Version: >= 1.6+Cabal-Version: >= 1.8 License: BSD3 License-File: LICENSE Stability: Experimental@@ -32,3 +32,9 @@ Zora.Math Zora.Graphing.TreeGraphing Zora.Graphing.DAGGraphing++Test-Suite test-zora+ type: exitcode-stdio-1.0+ main-is: Tests/test-zora.hs+ build-depends: base >= 4 && < 5, Zora+ default-language: Haskell2010
Zora/List.hs view
@@ -390,17 +390,17 @@ take_while_keep_last f [] = [] take_while_keep_last f (x:xs) = if f x- then [x]- else x : take_while_keep_last f xs+ then x : take_while_keep_last f xs+ else [x] -- | /(O(n))/ Returns a pair where the first element is identical to what `takeWhile` returns and the second element is the rest of the list -- -- > take_while_and_rest (<3) [1..10] == ([1,2],[3,4,5,6,7,8,9,10]) take_while_and_rest :: (a -> Bool) -> [a] -> ([a], [a]) take_while_and_rest f [] = ([], [])-take_while_and_rest f l@(x:xs) = if not . f $ x- then ([], l)- else (x:(fst rec), snd rec)+take_while_and_rest f l@(x:xs) = if f x+ then (x:(fst rec), snd rec)+ else ([], l) where rec = take_while_and_rest f xs