Skip to content

Commit

Permalink
Fix src-assertions/Assertion.hs build error and remove unliftedarrayf…
Browse files Browse the repository at this point in the history
…unctions cabal flag
  • Loading branch information
andrewthad committed Feb 26, 2024
1 parent 820ce9e commit 9f5a76f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
12 changes: 1 addition & 11 deletions posix-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,6 @@ flag assertions
description: Extra run-time invariant checking
default: False

-- This only exists to help get this library to build on hackage.
-- Whenever hackage moves to GHC 9.4, remove this.
flag unliftedarrayfunctions
manual: True
description: Build and export functions using unlifted arrays
default: True

common build-settings
default-language: Haskell2010
ghc-options: -Wall -Wunused-packages
Expand Down Expand Up @@ -126,15 +119,12 @@ library
, base >=4.16.3 && <5
, byte-order >=0.1.2 && <0.2
, byteslice >=0.2.10 && <0.3
, primitive >=0.7 && <0.10
, primitive >=0.9 && <0.10
, primitive-addr >=0.1 && <0.2
, primitive-offset >=0.2 && <0.3
, run-st >=0.1.1 && <0.2
, text-short >=0.1.5

if flag(unliftedarrayfunctions)
build-depends: primitive-unlifted >=2.1 && <2.2

hs-source-dirs: src

if flag(assertions)
Expand Down
14 changes: 3 additions & 11 deletions src-assertions/Assertion.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,16 @@ import qualified GHC.Exts as Exts

assertMutablePrimArrayPinned :: PM.MutablePrimArray s a -> PM.MutablePrimArray s a
assertMutablePrimArrayPinned x =
if isMutablePrimArrayPinned x
if PM.isMutablePrimArrayPinned x
then x
else error "assertMutablePrimArrayPinned"

assertMutableByteArrayPinned :: PM.MutablePrimArray s a -> PM.MutablePrimArray s a
assertMutableByteArrayPinned :: PM.MutableByteArray s -> PM.MutableByteArray s
assertMutableByteArrayPinned x =
if isMutableByteArrayPinned x
if PM.isMutableByteArrayPinned x
then x
else error "assertMutableByteArrayPinned"

isMutablePrimArrayPinned :: PM.MutablePrimArray s a -> Bool
{-# INLINE isMutablePrimArrayPinned #-}
isMutablePrimArrayPinned (PM.MutablePrimArray marr#) = isTrue# (Exts.isMutableByteArrayPinned# marr#)

isMutableByteArrayPinned :: PM.MutableByteArray s -> Bool
{-# INLINE isMutableByteArrayPinned #-}
isMutableByteArrayPinned (PM.MutableByteArray marr#) = isTrue# (Exts.isMutableByteArrayPinned# marr#)

assertByteArrayPinned :: PM.ByteArray -> PM.ByteArray
assertByteArrayPinned x =
if PM.isByteArrayPinned x
Expand Down

0 comments on commit 9f5a76f

Please sign in to comment.