packages feed

PrimitiveArray 0.0.2.2 → 0.0.3.0

raw patch · 4 files changed

+43/−13 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.PrimitiveArray: instance (Bounded a, Read a, Read b, PrimArrayOps a b) => Read (PrimArray a b)
+ Data.PrimitiveArray: instance (Bounded a, Show a, Show b, PrimArrayOps a b) => Show (PrimArray a b)

Files

Data/PrimitiveArray.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE MultiParamTypeClasses #-} @@ -15,6 +16,9 @@  import Control.Monad.Primitive (PrimMonad) import Control.Exception (assert)+import Text.Read.Lex as L+import Text.Read+import Text.ParserCombinators.ReadP  -- * The PrimArray class. @@ -58,10 +62,32 @@   (lb,ub) = bounds pa  --- NOTE Show instances are possible but you are probably better with your own. -{--instance (PrimArrayOps a b, Show a, Show b) => Show (PrimArray a b) where-  show pa = "fromList " ++ show lb ++ " " ++ show ub ++ " " ++ (show $ toList pa) where-    (lb,ub) = bounds pa--}+-- * Read and show instances++-- | The Show instance looks a bit like Show for Data.Vector.Unboxed++instance (Bounded a, Show a, Show b, PrimArrayOps a b) => Show (PrimArray a b) where+  show pa = "fromList " ++ show l ++ " " ++ show u ++ " " ++ (show $ toList pa) ++ " :: Data.PrimitiveArray.PrimitiveArray" where+    (l,u) = bounds pa++-- | The Read instance follows Read for Data.Vector.Unboxed++instance (Bounded a, Read a, Read b, PrimArrayOps a b) => Read (PrimArray a b) where+  readPrec =+    parens $ do+      lift $ skipSpaces+      L.Ident "fromList" <- lexP+      lift $ skipSpaces+      (l :: a) <- readPrec+      lift $ skipSpaces+      (u :: a) <- readPrec+      (vals :: [b])  <- readPrec+      lift $ skipSpaces+      lift $ string "::"+      lift $ skipSpaces+      lift $ string "Data.PrimitiveArray.PrimitiveArray"+      lift $ skipSpaces+      return $ fromList l u vals+  readListPrec = readListPrecDefault+  readList     = readListDefault
Data/PrimitiveArray/Internal.hs view
@@ -21,6 +21,3 @@ new l z = do   marr <- newByteArray (l * sizeOf z)   return marr---
Data/PrimitiveArray/Ix.hs view
@@ -71,3 +71,11 @@   {-# INLINE fromListM #-}   {-# INLINE toListM #-} +++{-+test :: PrimArray (Int,Int) Int+test = fromList (1,1) (5,5) [ (i*6+j) | i<-[1..5], j<-[1..5] ]++testS = " " ++ show test ++ " " -- show (test,test)+-}
PrimitiveArray.cabal view
@@ -1,5 +1,5 @@ Name:           PrimitiveArray-Version:        0.0.2.2+Version:        0.0.3.0 License:        BSD3 License-file:   LICENSE Author:         Christian Hoener zu Siederdissen@@ -15,9 +15,8 @@                 package. Description:                 Provides unboxed multidimensional tables with a small-                interface. Comes with an instance for Ix keys.-                .-                * haddock should work now+                interface. Comes with an instance for Ix keys. Read and Show+                instances are provides for serialization.  extra-source-files:   Benchmarks/Index.hs