packages feed

universe-base 1.0.1 → 1.0.2

raw patch · 2 files changed

+14/−6 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Universe.Helpers: diagonals :: [[a]] -> [[a]]

Files

Data/Universe/Helpers.hs view
@@ -28,12 +28,20 @@ -- output list. Elements from lists at lower index occur more frequently, but -- not exponentially so. diagonal :: [[a]] -> [a]-diagonal xss = go ([], xss) where+diagonal = concat . diagonals++-- | Like 'diagonal', but expose a tiny bit more (non-semantic) information:+-- if you lay out the input list in two dimensions, each list in the result+-- will be one of the diagonals of the input. In particular, each element of+-- the output will be a list whose elements are each from a distinct input+-- list.+diagonals :: [[a]] -> [[a]]+diagonals = go [] where 	-- it is critical for some applications that we start producing answers 	-- before inspecting es_-	go (b, es_) = [h | h:_ <- b] ++ case es_ of-		[]   -> interleave ts-		e:es -> go (e:ts, es)+	go b es_ = [h | h:_ <- b] : case es_ of+		[]   -> transpose ts+		e:es -> go (e:ts) es 		where ts = [t | _:t <- b]  -- | Fair 2-way interleaving.
universe-base.cabal view
@@ -1,5 +1,5 @@ name:                universe-base-version:             1.0.1+version:             1.0.2 synopsis:            A class for finite and recursively enumerable types and some helper functions for enumerating them homepage:            https://github.com/dmwit/universe license:             BSD3@@ -16,7 +16,7 @@ source-repository this     type:            git     location:        https://github.com/dmwit/universe-    tag:             base-1.0.1+    tag:             base-1.0.2  library   exposed-modules:     Data.Universe.Class, Data.Universe.Helpers