pointedlist 0.0.2 → 0.1
raw patch · 2 files changed
+16/−2 lines, 2 filesdep +binary
Dependencies added: binary
Files
- Data/List/PointedList.hs +14/−1
- pointedlist.cabal +2/−1
Data/List/PointedList.hs view
@@ -6,6 +6,7 @@ import Control.Applicative import Control.Monad+import Data.Binary import Data.Foldable import Data.List hiding (foldl, foldr) import Data.Maybe@@ -14,7 +15,7 @@ -- | The implementation of the pointed list structure which tracks the current -- position in the list structure. data PointedList a = PointedList [a] a [a]- deriving (Eq, Ord)+ deriving (Eq, Ord {-! Binary !-}) instance (Show a) => Show (PointedList a) where show (PointedList ls x rs) = show (reverse ls) ++ " " ++ show x ++ " " ++ show rs@@ -143,3 +144,15 @@ -- > contextMap atStart (fromJust $ fromList [1..5]) contextMap :: (PointedList a -> b) -> PointedList a -> PointedList b contextMap f z = fmap f $ positions z++--------------------------------------------------------+-- DERIVES GENERATED CODE+-- DO NOT MODIFY BELOW THIS LINE+-- CHECKSUM: 1323105363++instance Binary t1 => Binary (PointedList t1)+ where put (PointedList x1+ x2+ x3) = return () >> (put x1 >> (put x2 >> put x3))+ get = case 0 of+ 0 -> ap (ap (ap (return PointedList) get) get) get
pointedlist.cabal view
@@ -1,5 +1,5 @@ Name: pointedlist-Version: 0.0.2+Version: 0.1 Synopsis: A zipper-like comonad which works as a list, tracking a position. Category: Data Description:@@ -12,4 +12,5 @@ Maintainer: jeffwheeler@gmail.com Build-type: Simple Build-depends: base>=4+Build-depends: binary Exposed-modules: Data.List.PointedList