packages feed

hw-prim 0.0.2.0 → 0.0.3.0

raw patch · 3 files changed

+32/−5 lines, 3 filesdep ~hw-primPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hw-prim

API changes (from Hackage documentation)

+ HaskellWorks.Data.Vector.VectorLike: vUncons :: VectorLike v => v -> Maybe (Elem v, v)

Files

README.md view
@@ -1,4 +1,8 @@ # hw-prim-[![v0.0-branch](https://circleci.com/gh/haskell-works/hw-prim/tree/v0.0-branch.svg?style=svg)](https://circleci.com/gh/haskell-works/hw-prim/tree/v0.0-branch)+[![0.0-branch](https://circleci.com/gh/haskell-works/hw-prim/tree/0.0-branch.svg?style=svg)](https://circleci.com/gh/haskell-works/hw-prim/tree/0.0-branch)  Primitive types library.++To build with GHC 8: `nix-build --arg compiler \"ghc801\"`++Report dependency build errors: https://github.com/haskell-infra/hackage-trustees
hw-prim.cabal view
@@ -1,5 +1,5 @@ name:                   hw-prim-version:                0.0.2.0+version:                0.0.3.0 synopsis:               Primitive functions and data types description:            Please see README.md homepage:               http://github.com/haskell-works/hw-prim#readme@@ -12,14 +12,14 @@ stability:              Experimental build-type:             Simple extra-source-files:     README.md-cabal-version:          >= 1.10+cabal-version:          >= 1.22  executable hw-prim-example   hs-source-dirs:       app   main-is:              Main.hs   ghc-options:          -threaded -rtsopts -with-rtsopts=-N -Wall -msse4.2   build-depends:        base                          >= 4          && < 5-                      , hw-prim                       >= 0.0.1+                      , hw-prim   default-language:     Haskell2010  library@@ -66,5 +66,5 @@     Default-Language: Haskell2010     Build-Depends:      base                          >= 4          && < 5                       , criterion-                      , hw-prim                       >= 0.0.1+                      , hw-prim                       , vector
src/HaskellWorks/Data/Vector/VectorLike.hs view
@@ -26,6 +26,7 @@   vTake :: Count -> v -> v   vIndex :: v -> Position -> Elem v   vSlice :: Position -> Position -> v -> v+  vUncons :: v -> Maybe (Elem v, v)  instance VectorLike String where   type Elem String = Char@@ -40,6 +41,9 @@   vTake = take . fromIntegral   vIndex v (Position i) = v !! fromIntegral i   vSlice (Position i) (Position j) = take (fromIntegral j) . drop (fromIntegral i)+  vUncons s = case s of+    (x:xs)  -> Just (x, xs)+    _       -> Nothing   {-# INLINE (!!!)     #-}   {-# INLINE vConcat   #-}   {-# INLINE vEmpty    #-}@@ -51,6 +55,7 @@   {-# INLINE vTake     #-}   {-# INLINE vIndex    #-}   {-# INLINE vSlice    #-}+  {-# INLINE vUncons   #-}  instance VectorLike BS.ByteString where   type Elem BS.ByteString = Word8@@ -67,6 +72,7 @@   vTake = BS.take . fromIntegral   vIndex v (Position i) = BS.index v (fromIntegral i)   vSlice (Position i) (Position j) = BS.take (fromIntegral j) . BS.drop (fromIntegral i)+  vUncons = BS.uncons   {-# INLINE (!!!)     #-}   {-# INLINE vConcat   #-}   {-# INLINE vEmpty    #-}@@ -78,6 +84,7 @@   {-# INLINE vTake     #-}   {-# INLINE vIndex    #-}   {-# INLINE vSlice    #-}+  {-# INLINE vUncons   #-}  instance VectorLike (DV.Vector Word8) where   type Elem (DV.Vector Word8) = Word8@@ -93,6 +100,7 @@   vTake = DV.take . fromIntegral   vIndex v (Position i) = DV.unsafeIndex v (fromIntegral i)   vSlice (Position i) (Position j) = DV.unsafeSlice (fromIntegral i) (fromIntegral j)+  vUncons s = if DV.length s == 0 then Nothing else Just (s !!! 0, vDrop 1 s)   {-# INLINE (!!!)     #-}   {-# INLINE vConcat   #-}   {-# INLINE vEmpty    #-}@@ -104,6 +112,7 @@   {-# INLINE vTake     #-}   {-# INLINE vIndex    #-}   {-# INLINE vSlice    #-}+  {-# INLINE vUncons   #-}  instance VectorLike (DV.Vector Word16) where   type Elem (DV.Vector Word16) = Word16@@ -119,6 +128,7 @@   vTake = DV.take . fromIntegral   vIndex v (Position i) = DV.unsafeIndex v (fromIntegral i)   vSlice (Position i) (Position j) = DV.unsafeSlice (fromIntegral i) (fromIntegral j)+  vUncons s = if DV.length s == 0 then Nothing else Just (s !!! 0, vDrop 1 s)   {-# INLINE (!!!)     #-}   {-# INLINE vConcat   #-}   {-# INLINE vEmpty    #-}@@ -130,6 +140,7 @@   {-# INLINE vTake     #-}   {-# INLINE vIndex    #-}   {-# INLINE vSlice    #-}+  {-# INLINE vUncons   #-}  instance VectorLike (DV.Vector Word32) where   type Elem (DV.Vector Word32) = Word32@@ -145,6 +156,7 @@   vTake = DV.take . fromIntegral   vIndex v (Position i) = DV.unsafeIndex v (fromIntegral i)   vSlice (Position i) (Position j) = DV.unsafeSlice (fromIntegral i) (fromIntegral j)+  vUncons s = if DV.length s == 0 then Nothing else Just (s !!! 0, vDrop 1 s)   {-# INLINE (!!!)     #-}   {-# INLINE vConcat   #-}   {-# INLINE vEmpty    #-}@@ -156,6 +168,7 @@   {-# INLINE vTake     #-}   {-# INLINE vIndex    #-}   {-# INLINE vSlice    #-}+  {-# INLINE vUncons   #-}  instance VectorLike (DV.Vector Word64) where   type Elem (DV.Vector Word64) = Word64@@ -171,6 +184,7 @@   vTake = DV.take . fromIntegral   vIndex v (Position i) = DV.unsafeIndex v (fromIntegral i)   vSlice (Position i) (Position j) = DV.unsafeSlice (fromIntegral i) (fromIntegral j)+  vUncons s = if DV.length s == 0 then Nothing else Just (s !!! 0, vDrop 1 s)   {-# INLINE (!!!)     #-}   {-# INLINE vConcat   #-}   {-# INLINE vEmpty    #-}@@ -182,6 +196,7 @@   {-# INLINE vTake     #-}   {-# INLINE vIndex    #-}   {-# INLINE vSlice    #-}+  {-# INLINE vUncons   #-}  instance VectorLike (DVS.Vector Word8) where   type Elem (DVS.Vector Word8) = Word8@@ -197,6 +212,7 @@   vTake = DVS.take . fromIntegral   vIndex v (Position i) = DVS.unsafeIndex v (fromIntegral i)   vSlice (Position i) (Position j) = DVS.unsafeSlice (fromIntegral i) (fromIntegral j)+  vUncons s = if DVS.length s == 0 then Nothing else Just (s !!! 0, vDrop 1 s)   {-# INLINE (!!!)     #-}   {-# INLINE vConcat   #-}   {-# INLINE vEmpty    #-}@@ -208,6 +224,7 @@   {-# INLINE vTake     #-}   {-# INLINE vIndex    #-}   {-# INLINE vSlice    #-}+  {-# INLINE vUncons   #-}  instance VectorLike (DVS.Vector Word16) where   type Elem (DVS.Vector Word16) = Word16@@ -223,6 +240,7 @@   vTake = DVS.take . fromIntegral   vIndex v (Position i) = DVS.unsafeIndex v (fromIntegral i)   vSlice (Position i) (Position j) = DVS.unsafeSlice (fromIntegral i) (fromIntegral j)+  vUncons s = if DVS.length s == 0 then Nothing else Just (s !!! 0, vDrop 1 s)   {-# INLINE (!!!)     #-}   {-# INLINE vConcat   #-}   {-# INLINE vEmpty    #-}@@ -234,6 +252,7 @@   {-# INLINE vTake     #-}   {-# INLINE vIndex    #-}   {-# INLINE vSlice    #-}+  {-# INLINE vUncons   #-}  instance VectorLike (DVS.Vector Word32) where   type Elem (DVS.Vector Word32) = Word32@@ -249,6 +268,7 @@   vTake = DVS.take . fromIntegral   vIndex v (Position i) = DVS.unsafeIndex v (fromIntegral i)   vSlice (Position i) (Position j) = DVS.unsafeSlice (fromIntegral i) (fromIntegral j)+  vUncons s = if DVS.length s == 0 then Nothing else Just (s !!! 0, vDrop 1 s)   {-# INLINE (!!!)     #-}   {-# INLINE vConcat   #-}   {-# INLINE vEmpty    #-}@@ -260,6 +280,7 @@   {-# INLINE vTake     #-}   {-# INLINE vIndex    #-}   {-# INLINE vSlice    #-}+  {-# INLINE vUncons   #-}  instance VectorLike (DVS.Vector Word64) where   type Elem (DVS.Vector Word64) = Word64@@ -275,6 +296,7 @@   vTake = DVS.take . fromIntegral   vIndex v (Position i) = DVS.unsafeIndex v (fromIntegral i)   vSlice (Position i) (Position j) = DVS.unsafeSlice (fromIntegral i) (fromIntegral j)+  vUncons s = if DVS.length s == 0 then Nothing else Just (s !!! 0, vDrop 1 s)   {-# INLINE (!!!)     #-}   {-# INLINE vConcat   #-}   {-# INLINE vEmpty    #-}@@ -286,3 +308,4 @@   {-# INLINE vTake     #-}   {-# INLINE vIndex    #-}   {-# INLINE vSlice    #-}+  {-# INLINE vUncons   #-}