use runByteArrayST instead of runST

This commit is contained in:
Andrew Martin 2019-09-04 13:40:31 -04:00
parent 61c7539cee
commit 2e8d4279c7

View file

@ -51,7 +51,8 @@ module Data.ByteArray.Builder.Bounded
import Arithmetic.Types (type (<=), type (:=:)) import Arithmetic.Types (type (<=), type (:=:))
import Control.Monad.Primitive import Control.Monad.Primitive
import Control.Monad.ST import Control.Monad.ST (ST)
import Control.Monad.ST.Run (runByteArrayST)
import Data.Bits import Data.Bits
import Data.ByteArray.Builder.Bounded.Unsafe (Builder(..)) import Data.ByteArray.Builder.Bounded.Unsafe (Builder(..))
import Data.Char (ord) import Data.Char (ord)
@ -76,7 +77,7 @@ run ::
-> Builder n -- ^ Builder -> Builder n -- ^ Builder
-> ByteArray -> ByteArray
{-# inline run #-} {-# inline run #-}
run n b = runST $ do run n b = runByteArrayST $ do
arr <- newByteArray (Nat.demote n) arr <- newByteArray (Nat.demote n)
len <- Unsafe.pasteST b arr 0 len <- Unsafe.pasteST b arr 0
shrinkMutableByteArray arr len shrinkMutableByteArray arr len