run-st 0.1.3.2 → 0.1.3.3
raw patch · 4 files changed
+105/−87 lines, 4 filessetup-changednew-uploader
Files
- CHANGELOG.md +5/−1
- Setup.hs +0/−2
- run-st.cabal +29/−19
- src/Control/Monad/ST/Run.hs +71/−65
CHANGELOG.md view
@@ -1,6 +1,10 @@ # Revision history for run-st -## 0.1.3.2 -- 2024-06-28+## 0.1.3.3 -- 2024-02-13++* Update package metadata.++## 0.1.3.2 -- 2023-06-28 * Make type signature of `runUnliftedArrayST` more flexible.
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
run-st.cabal view
@@ -1,29 +1,39 @@-cabal-version: 2.2-name: run-st-version: 0.1.3.2-synopsis: runST without boxing penalty+cabal-version: 2.2+name: run-st+version: 0.1.3.3+synopsis: runST without boxing penalty description: This package provides specializations of `runST` that avoid a needless data-constructor allocation for the returned value. If <https://gitlab.haskell.org/ghc/ghc/issues/15127 issue 15127> is resolved, this package will no longer be necessary. -homepage: https://github.com/andrewthad/run-st-bug-reports: https://github.com/andrewthad/run-st/issues-license: BSD-3-Clause-license-file: LICENSE-author: Andrew Martin-maintainer: andrew.thaddeus@gmail.com-copyright: 2019 Andrew Martin-category: Data-extra-source-files: CHANGELOG.md+homepage: https://github.com/byteverse/run-st+bug-reports: https://github.com/byteverse/run-st/issues+license: BSD-3-Clause+license-file: LICENSE+author: Andrew Martin+maintainer: amartin@layer3com.com+copyright: 2019 Andrew Martin+category: Data+extra-doc-files: CHANGELOG.md+tested-with: GHC ==9.4.8 || ==9.6.3 || ==9.8.1 +common build-settings+ default-language: Haskell2010+ ghc-options: -Wall -Wunused-packages+ library+ import: build-settings exposed-modules: Control.Monad.ST.Run build-depends:- , base >=4.12 && <5- , primitive >=0.7 && <0.10- , primitive-unlifted >=2.1- hs-source-dirs: src- default-language: Haskell2010- ghc-options: -O2 -Wall+ , base >=4.12 && <5+ , primitive >=0.7 && <0.10+ , primitive-unlifted >=2.1++ hs-source-dirs: src+ ghc-options: -O2++source-repository head+ type: git+ location: git://github.com/byteverse/run-st.git
src/Control/Monad/ST/Run.hs view
@@ -1,8 +1,8 @@-{-# language BangPatterns #-}-{-# language KindSignatures #-}-{-# language MagicHash #-}-{-# language RankNTypes #-}-{-# language UnboxedTuples #-}+{-# LANGUAGE BangPatterns #-}+{-# LANGUAGE KindSignatures #-}+{-# LANGUAGE MagicHash #-}+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE UnboxedTuples #-} module Control.Monad.ST.Run ( -- * Arrays@@ -11,6 +11,7 @@ , runByteArrayST , runPrimArrayST , runUnliftedArrayST+ -- * Integral Types , runIntST , runInt8ST@@ -20,11 +21,14 @@ , runWord8ST , runWord16ST , runWord32ST+ -- * Char , runCharST+ -- * Floating Point Types , runFloatST , runDoubleST+ -- * Tuples , runIntArrayST , runIntByteArrayST@@ -32,130 +36,132 @@ , runIntIntByteArrayST , runWordArrayST , runWordByteArrayST+ -- * Maybes , runMaybeByteArrayST ) where import Data.Kind (Type)-import Data.Primitive.Array (Array(Array))-import Data.Primitive.ByteArray (ByteArray(ByteArray))-import Data.Primitive.PrimArray (PrimArray(PrimArray))-import Data.Primitive.SmallArray (SmallArray(SmallArray))-import Data.Primitive.Unlifted.Array (UnliftedArray_(UnliftedArray))-import GHC.Exts (Char(C#),Int(I#),Word(W#),runRW#)-import GHC.Exts (Double(D#),Float(F#))-import GHC.Int (Int8(I8#),Int16(I16#),Int32(I32#))-import GHC.ST (ST(ST))-import GHC.Word (Word8(W8#),Word16(W16#),Word32(W32#))+import Data.Primitive.Array (Array (Array))+import Data.Primitive.ByteArray (ByteArray (ByteArray))+import Data.Primitive.PrimArray (PrimArray (PrimArray))+import Data.Primitive.SmallArray (SmallArray (SmallArray))+import Data.Primitive.Unlifted.Array (UnliftedArray_ (UnliftedArray))+import GHC.Exts (Char (C#), Double (D#), Float (F#), Int (I#), Word (W#), runRW#)+import GHC.Int (Int16 (I16#), Int32 (I32#), Int8 (I8#))+import GHC.ST (ST (ST))+import GHC.Word (Word16 (W16#), Word32 (W32#), Word8 (W8#)) runArrayST :: (forall s. ST s (Array a)) -> Array a-{-# inline runArrayST #-}-runArrayST f = Array (runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, Array r #) -> r }}))+{-# INLINE runArrayST #-}+runArrayST f = Array (runRW# (\s0 -> case f of ST g -> case g s0 of (# _, Array r #) -> r)) runSmallArrayST :: (forall s. ST s (SmallArray a)) -> SmallArray a-{-# inline runSmallArrayST #-}-runSmallArrayST f = SmallArray (runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, SmallArray r #) -> r }}))+{-# INLINE runSmallArrayST #-}+runSmallArrayST f = SmallArray (runRW# (\s0 -> case f of ST g -> case g s0 of (# _, SmallArray r #) -> r)) runByteArrayST :: (forall s. ST s ByteArray) -> ByteArray-{-# inline runByteArrayST #-}-runByteArrayST f = ByteArray (runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, ByteArray r #) -> r }}))+{-# INLINE runByteArrayST #-}+runByteArrayST f = ByteArray (runRW# (\s0 -> case f of ST g -> case g s0 of (# _, ByteArray r #) -> r)) runPrimArrayST :: (forall s. ST s (PrimArray a)) -> PrimArray a-{-# inline runPrimArrayST #-}-runPrimArrayST f = PrimArray (runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, PrimArray r #) -> r }}))+{-# INLINE runPrimArrayST #-}+runPrimArrayST f = PrimArray (runRW# (\s0 -> case f of ST g -> case g s0 of (# _, PrimArray r #) -> r)) runUnliftedArrayST :: (forall s. ST s (UnliftedArray_ unlifted_a a)) -> UnliftedArray_ unlifted_a a-{-# inline runUnliftedArrayST #-}-runUnliftedArrayST f = UnliftedArray (runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, UnliftedArray r #) -> r }}))+{-# INLINE runUnliftedArrayST #-}+runUnliftedArrayST f = UnliftedArray (runRW# (\s0 -> case f of ST g -> case g s0 of (# _, UnliftedArray r #) -> r)) runCharST :: (forall s. ST s Char) -> Char-{-# inline runCharST #-}-runCharST f = C# (runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, C# r #) -> r }}))+{-# INLINE runCharST #-}+runCharST f = C# (runRW# (\s0 -> case f of ST g -> case g s0 of (# _, C# r #) -> r)) runFloatST :: (forall s. ST s Float) -> Float-{-# inline runFloatST #-}-runFloatST f = F# (runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, F# r #) -> r }}))+{-# INLINE runFloatST #-}+runFloatST f = F# (runRW# (\s0 -> case f of ST g -> case g s0 of (# _, F# r #) -> r)) runDoubleST :: (forall s. ST s Double) -> Double-{-# inline runDoubleST #-}-runDoubleST f = D# (runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, D# r #) -> r }}))+{-# INLINE runDoubleST #-}+runDoubleST f = D# (runRW# (\s0 -> case f of ST g -> case g s0 of (# _, D# r #) -> r)) runIntST :: (forall s. ST s Int) -> Int-{-# inline runIntST #-}-runIntST f = I# (runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, I# r #) -> r }}))+{-# INLINE runIntST #-}+runIntST f = I# (runRW# (\s0 -> case f of ST g -> case g s0 of (# _, I# r #) -> r)) runWordST :: (forall s. ST s Word) -> Word-{-# inline runWordST #-}-runWordST f = W# (runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, W# r #) -> r }}))+{-# INLINE runWordST #-}+runWordST f = W# (runRW# (\s0 -> case f of ST g -> case g s0 of (# _, W# r #) -> r)) runWord8ST :: (forall s. ST s Word8) -> Word8-{-# inline runWord8ST #-}-runWord8ST f = W8# (runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, W8# r #) -> r }}))+{-# INLINE runWord8ST #-}+runWord8ST f = W8# (runRW# (\s0 -> case f of ST g -> case g s0 of (# _, W8# r #) -> r)) runWord16ST :: (forall s. ST s Word16) -> Word16-{-# inline runWord16ST #-}-runWord16ST f = W16# (runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, W16# r #) -> r }}))+{-# INLINE runWord16ST #-}+runWord16ST f = W16# (runRW# (\s0 -> case f of ST g -> case g s0 of (# _, W16# r #) -> r)) runWord32ST :: (forall s. ST s Word32) -> Word32-{-# inline runWord32ST #-}-runWord32ST f = W32# (runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, W32# r #) -> r }}))+{-# INLINE runWord32ST #-}+runWord32ST f = W32# (runRW# (\s0 -> case f of ST g -> case g s0 of (# _, W32# r #) -> r)) runInt8ST :: (forall s. ST s Int8) -> Int8-{-# inline runInt8ST #-}-runInt8ST f = I8# (runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, I8# r #) -> r }}))+{-# INLINE runInt8ST #-}+runInt8ST f = I8# (runRW# (\s0 -> case f of ST g -> case g s0 of (# _, I8# r #) -> r)) runInt16ST :: (forall s. ST s Int16) -> Int16-{-# inline runInt16ST #-}-runInt16ST f = I16# (runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, I16# r #) -> r }}))+{-# INLINE runInt16ST #-}+runInt16ST f = I16# (runRW# (\s0 -> case f of ST g -> case g s0 of (# _, I16# r #) -> r)) runInt32ST :: (forall s. ST s Int32) -> Int32-{-# inline runInt32ST #-}-runInt32ST f = I32# (runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, I32# r #) -> r }}))+{-# INLINE runInt32ST #-}+runInt32ST f = I32# (runRW# (\s0 -> case f of ST g -> case g s0 of (# _, I32# r #) -> r)) runIntArrayST :: (forall s. ST s (Int, Array a)) -> (Int, Array a)-{-# inline runIntArrayST #-}+{-# INLINE runIntArrayST #-} runIntArrayST f =- let !(# t0, t1 #) = runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, ( I# r0, Array r1 ) #) -> (# r0, r1 #) }})+ let !(# t0, t1 #) = runRW# (\s0 -> case f of ST g -> case g s0 of (# _, (I# r0, Array r1) #) -> (# r0, r1 #)) in (I# t0, Array t1) runWordArrayST :: (forall s. ST s (Word, Array a)) -> (Word, Array a)-{-# inline runWordArrayST #-}+{-# INLINE runWordArrayST #-} runWordArrayST f =- let !(# t0, t1 #) = runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, ( W# r0, Array r1 ) #) -> (# r0, r1 #) }})+ let !(# t0, t1 #) = runRW# (\s0 -> case f of ST g -> case g s0 of (# _, (W# r0, Array r1) #) -> (# r0, r1 #)) in (W# t0, Array t1) runIntLiftedTypeST :: forall (a :: Type). (forall s. ST s (Int, a)) -> (Int, a)-{-# inline runIntLiftedTypeST #-}+{-# INLINE runIntLiftedTypeST #-} runIntLiftedTypeST f =- let !(# t0, t1 #) = runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, ( I# r0, r1 ) #) -> (# r0, r1 #) }})+ let !(# t0, t1 #) = runRW# (\s0 -> case f of ST g -> case g s0 of (# _, (I# r0, r1) #) -> (# r0, r1 #)) in (I# t0, t1) runIntByteArrayST :: (forall s. ST s (Int, ByteArray)) -> (Int, ByteArray)-{-# inline runIntByteArrayST #-}+{-# INLINE runIntByteArrayST #-} runIntByteArrayST f =- let !(# t0, t1 #) = runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, ( I# r0, ByteArray r1 ) #) -> (# r0, r1 #) }})+ let !(# t0, t1 #) = runRW# (\s0 -> case f of ST g -> case g s0 of (# _, (I# r0, ByteArray r1) #) -> (# r0, r1 #)) in (I# t0, ByteArray t1) runIntIntByteArrayST :: (forall s. ST s (Int, Int, ByteArray)) -> (Int, Int, ByteArray)-{-# inline runIntIntByteArrayST #-}+{-# INLINE runIntIntByteArrayST #-} runIntIntByteArrayST f =- let !(# t0, t1, t2 #) = runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, ( I# r0, I# r1, ByteArray r2 ) #) -> (# r0, r1, r2 #) }})+ let !(# t0, t1, t2 #) = runRW# (\s0 -> case f of ST g -> case g s0 of (# _, (I# r0, I# r1, ByteArray r2) #) -> (# r0, r1, r2 #)) in (I# t0, I# t1, ByteArray t2) runWordByteArrayST :: (forall s. ST s (Word, ByteArray)) -> (Word, ByteArray)-{-# inline runWordByteArrayST #-}+{-# INLINE runWordByteArrayST #-} runWordByteArrayST f =- let !(# t0, t1 #) = runRW# (\s0 -> case f of { ST g -> case g s0 of { (# _, ( W# r0, ByteArray r1 ) #) -> (# r0, r1 #) }})+ let !(# t0, t1 #) = runRW# (\s0 -> case f of ST g -> case g s0 of (# _, (W# r0, ByteArray r1) #) -> (# r0, r1 #)) in (W# t0, ByteArray t1) runMaybeByteArrayST :: (forall s. ST s (Maybe ByteArray)) -> Maybe ByteArray-{-# inline runMaybeByteArrayST #-}+{-# INLINE runMaybeByteArrayST #-} runMaybeByteArrayST f =- let !x = runRW#- (\s0 -> case f of { ST g -> case g s0 of- { (# _, Just (ByteArray r2 ) #) -> (# | r2 #)- ; (# _, Nothing #) -> (# (# #) | #)- }})+ let !x =+ runRW#+ ( \s0 -> case f of+ ST g -> case g s0 of+ (# _, Just (ByteArray r2) #) -> (# | r2 #)+ (# _, Nothing #) -> (# (# #) | #)+ ) in case x of (# (# #) | #) -> Nothing (# | y #) -> Just (ByteArray y)