From 859680253f50ebd409827d2205d19cacf3f2f0f4 Mon Sep 17 00:00:00 2001 From: William Rusnack Date: Tue, 27 Feb 2024 10:19:23 -0500 Subject: [PATCH] Upped version, example mappings --- mono-traversable/mono-traversable.cabal | 2 +- mono-traversable/package.yaml | 2 +- mono-traversable/src/Data/Sequences.hs | 26 ++++++++++++++++++++----- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/mono-traversable/mono-traversable.cabal b/mono-traversable/mono-traversable.cabal index 3502f2ba..ce23ff35 100644 --- a/mono-traversable/mono-traversable.cabal +++ b/mono-traversable/mono-traversable.cabal @@ -5,7 +5,7 @@ cabal-version: 1.12 -- see: https://github.com/sol/hpack name: mono-traversable -version: 1.0.16.0 +version: 1.0.17.0 synopsis: Type classes for mapping, folding, and traversing monomorphic containers description: Please see the README at category: Data diff --git a/mono-traversable/package.yaml b/mono-traversable/package.yaml index 4aac5078..3b46d56e 100644 --- a/mono-traversable/package.yaml +++ b/mono-traversable/package.yaml @@ -1,5 +1,5 @@ name: mono-traversable -version: 1.0.16.0 +version: 1.0.17.0 synopsis: Type classes for mapping, folding, and traversing monomorphic containers description: Please see the README at category: Data diff --git a/mono-traversable/src/Data/Sequences.hs b/mono-traversable/src/Data/Sequences.hs index 67c00e3f..e3d89881 100644 --- a/mono-traversable/src/Data/Sequences.hs +++ b/mono-traversable/src/Data/Sequences.hs @@ -474,13 +474,27 @@ class (Monoid seq, MonoTraversable seq, SemiSequence seq, MonoPointed seq) => Is -- | Returns all the final segments of 'seq' with the longest first. -- - -- @since ???? + -- @ + -- > tails [1,2] + -- [[1,2],[2],[]] + -- > tails [] + -- [[]] + -- @ + -- + -- @since 1.0.17.0 tails :: seq -> [seq] tails x = x : maybe mempty tails (tailMay x) -- | Return all the initial segments of 'seq' with the shortest first. -- - -- @since ???? + -- @ + -- > inits [1,2] + -- [[],[1],[1,2]] + -- > inits [] + -- [[]] + -- @ + -- + -- @since 1.0.17.0 inits :: seq -> [seq] inits seq = is seq [seq] where @@ -489,11 +503,13 @@ class (Monoid seq, MonoTraversable seq, SemiSequence seq, MonoPointed seq) => Is -- | Return all the pairs of inital and final segments of 'seq'. -- -- @ - -- > 'initTails' [1,2] - -- [([],[1,2]), ([1],[2]), ([1,2],[])] + -- > initTails [1,2] + -- [([],[1,2]),([1],[2]),([1,2],[])] + -- > initTails [] + -- [([],[])] -- @ -- - -- @since ???? + -- @since 1.0.17.0 initTails :: seq -> [(seq,seq)] initTails seq = List.zip (inits seq) (tails seq)