Skip to content

Commit

Permalink
bump primitive upper bound to 0.9 (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
4eUeP authored Jun 28, 2024
1 parent e91e47f commit c12edb0
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 21 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:
${{ runner.os }}-
- name: Setup Haskell
uses: haskell/actions/setup@v1
uses: haskell-actions/setup@v2
with:
ghc-version: 9.2
cabal-version: 3.6
ghc-version: 9.6
cabal-version: 3.8

- name: Publish package
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntuCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
submodules: 'recursive'

- name: Setup Haskell
uses: haskell/actions/setup@v2
uses: haskell-actions/setup@v2
id: setup-haskell-cabal # <--- give it a name for later cache usage
with:
ghc-version: ${{ matrix.ghc }}
Expand Down
4 changes: 2 additions & 2 deletions Z-Data.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: Z-Data
version: 2.0.0.2
version: 2.0.1.0
synopsis: Array, vector and text
description: This package provides array, slice and text operations
license: BSD-3-Clause
Expand Down Expand Up @@ -185,7 +185,7 @@ library
, containers ^>=0.6
, deepseq ^>=1.4
, hashable >=1.3 && < 1.5
, primitive >=0.7.3 && <0.8
, primitive >=0.7.3 && <1.0
, QuickCheck >=2.10
, random >=1.2.0 && <1.3
, scientific >=0.3.7 && <0.4
Expand Down
21 changes: 16 additions & 5 deletions Z/Data/Array/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,27 @@ module Z.Data.Array.Base (
, sizeOf
) where

import Control.Exception (ArrayException (..), throw)
import Control.Exception (ArrayException (..), throw)
import Control.Monad
import Control.Monad.Primitive
import Control.Monad.ST
import Data.Bits (unsafeShiftL)
import Data.Kind (Type)
import Data.Bits (unsafeShiftL)
import Data.Kind (Type)
import Data.Primitive.Array
import Data.Primitive.ByteArray
#if !MIN_VERSION_primitive(0, 9, 0)
import Data.Primitive.PrimArray
import Data.Primitive.Ptr (copyPtrToMutablePrimArray)
#else
import Data.Primitive.PrimArray hiding
(withMutablePrimArrayContents,
withPrimArrayContents)
#endif
import Data.Primitive.Ptr (copyPtrToMutablePrimArray)

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.6

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.6

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.6

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.6

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.6

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.6

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.6

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.6

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.6

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.6

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.6

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.6

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.6

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.6

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.6

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.6

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.4

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant

Check warning on line 80 in Z/Data/Array/Base.hs

View workflow job for this annotation

GitHub Actions / Haskell GHC 9.2

The import of ‘Data.Primitive.Ptr’ is redundant
import Data.Primitive.SmallArray
import Data.Primitive.Types
import GHC.Exts
import System.Random.Stateful ( UniformRange(uniformRM), StatefulGen )
import System.Random.Stateful (StatefulGen,
UniformRange (uniformRM))
import Z.Data.Array.Cast
import Z.Data.Array.UnliftedArray

Expand Down Expand Up @@ -589,6 +596,8 @@ instance PrimUnlifted a => Arr UnliftedArray a where

--------------------------------------------------------------------------------

-- FIXME: directly use Data.Primitive.PrimArray.withPrimArrayContents
-- when primitive>=0.9.0 ?
-- | Obtain the pointer to the content of an array, and the pointer should only be used during the IO action.
--
-- This operation is only safe on /pinned/ primitive arrays (Arrays allocated by 'newPinnedPrimArray' or
Expand All @@ -604,6 +613,8 @@ withPrimArrayContents (PrimArray ba#) f = do
primitive_ (touch# ba#)
return b

-- FIXME: directly use Data.Primitive.PrimArray.withMutablePrimArrayContents
-- when primitive>=0.9.0 ?
-- | Obtain the pointer to the content of an mutable array, and the pointer should only be used during the IO action.
--
-- This operation is only safe on /pinned/ primitive arrays (Arrays allocated by 'newPinnedPrimArray' or
Expand Down
8 changes: 7 additions & 1 deletion Z/Foreign.hs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,15 @@ import Data.ByteString.Short.Internal (ShortByteString (..),
fromShort, toShort)
import qualified Data.ByteString.Unsafe as B
import qualified Data.List as List
import Data.Primitive
import Data.Primitive.ByteArray
import Data.Primitive.Types
#if !MIN_VERSION_primitive(0, 9, 0)
import Data.Primitive.PrimArray
#else
import Data.Primitive.PrimArray hiding
(withMutablePrimArrayContents,
withPrimArrayContents)
#endif
import Data.Primitive.Ptr
import Data.Word
import Foreign.C.Types
Expand Down
22 changes: 13 additions & 9 deletions Z/Foreign/CPtr.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@ module Z.Foreign.CPtr (
, FunPtr
) where

import Control.Monad
import Control.Monad.Primitive
import Data.Primitive.PrimArray
import qualified Z.Data.Text as T
import GHC.Ptr
import GHC.Exts
import GHC.IO
import Z.Data.Array hiding (newPinnedPrimArray)
import Z.Foreign
import Control.Monad
import Control.Monad.Primitive
#if !MIN_VERSION_primitive(0, 9, 0)
import Data.Primitive.PrimArray
#else
import Data.Primitive.PrimArray hiding (withMutablePrimArrayContents)
#endif
import GHC.Exts
import GHC.IO
import GHC.Ptr
import Z.Data.Array hiding (newPinnedPrimArray)
import qualified Z.Data.Text as T
import Z.Foreign

-- | Lightweight foreign pointers.
newtype CPtr a = CPtr (PrimArray (Ptr a))
Expand Down

0 comments on commit c12edb0

Please sign in to comment.