packages feed

data-clist 0.0.3 → 0.0.4

raw patch · 2 files changed

+23/−11 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.CircularList: singleton :: a -> CList a
+ Data.CircularList: update :: a -> CList a -> CList a

Files

data-clist.cabal view
@@ -2,10 +2,10 @@ Synopsis: Simple functional ring type. Description: Simple functional bidirectional ring type. -             Given that the ring terminiology-             clashes with certain mathematical branches, we're using the term-             CList or CircularList instead.-Version: 0.0.3+             Given that the ring terminiology clashes with certain+             mathematical branches, we're using the term CList or+             CircularList instead.+Version: 0.0.4 License: BSD3 License-File: LICENSE Author: John Van Enk <vanenkj@gmail.com>
src/Data/CircularList.hs view
@@ -27,8 +27,8 @@ >     ^  The pointer at the bottom represents our position at the table. The element-currently in front of is is referred to as the `focus`. So, in this case, our-focus is 0.+currently in front of is is referred to as the `focus`. So, in this case,+our focus is 0.  If we were to rotate the table to the right using the `rotR` operation, we'd have the following table.@@ -41,8 +41,8 @@ >   0 1 2 >     ^ -This yeilds 1 as our new focus. Rotating this table left would return 0 to the-focus position.+This yeilds 1 as our new focus. Rotating this table left would return 0 to+the focus position.  -} module Data.CircularList (@@ -50,7 +50,9 @@     CList,     -- * Functions     -- ** Creation of CLists-    empty, fromList,+    empty, fromList, singleton,+    -- ** Update of CList+    update,     -- ** Converting CLists to Lists     leftElements, rightElements, toList, toInfList,     -- ** Extraction and Accumulation@@ -84,6 +86,16 @@                         (r,l) = splitAt (len `div` 2) is                     in CList (reverse l) i r +singleton :: a -> CList a+singleton a = CList [] a []++{- Updating of CLists -}++-- |Replaces the current focus with a new focus.+update :: a -> CList a -> CList a+update v Empty = CList [] v []+update v (CList l _ r) = CList l v r+ {- Creating Lists -}  -- |Starting with the focus, go left and accumulate all@@ -211,8 +223,8 @@                 r <- arbitrary                 return $ CList l f r     shrink (CList l f r) = Empty : [ CList l' f' r' | l' <- shrink l,-                                                    f' <- shrink f,-                                                    r' <- shrink r]+                                                      f' <- shrink f,+                                                      r' <- shrink r]     shrink Empty = []  instance Functor CList where