@@ -52,10 +52,9 @@ import qualified Data.ByteString.Unsafe as BS
5252import qualified Data.ByteString.Internal as BS
5353import Data.Primitive.ByteArray
5454
55- import qualified JavaScript.TypedArray.Internal.Types as I
56- import JavaScript.TypedArray.ArrayBuffer.Internal (SomeArrayBuffer )
57- import JavaScript.TypedArray.DataView.Internal (SomeDataView )
58- import qualified JavaScript.TypedArray.Internal as I
55+ import JavaScript.TypedArray
56+ hiding (fromByteArrayPrim , toByteArrayPrim , fromMutableByteArrayPrim , toMutableByteArrayPrim
57+ , toByteArray , fromByteArray )
5958
6059import GHC.ForeignPtr
6160
@@ -72,23 +71,23 @@ getArrayBuffer :: SomeBuffer any -> SomeArrayBuffer any
7271getArrayBuffer buf = js_getArrayBuffer buf
7372{-# INLINE getArrayBuffer #-}
7473
75- getInt32Array :: SomeBuffer any -> I. SomeInt32Array any
74+ getInt32Array :: SomeBuffer any -> SomeTypedArray any Int32
7675getInt32Array buf = js_getInt32Array buf
7776{-# INLINE getInt32Array #-}
7877
79- getUint8Array :: SomeBuffer any -> I. SomeUint8Array any
78+ getUint8Array :: SomeBuffer any -> SomeTypedArray any Word8
8079getUint8Array buf = js_getUint8Array buf
8180{-# INLINE getUint8Array #-}
8281
83- getUint16Array :: SomeBuffer any -> I. SomeUint16Array any
82+ getUint16Array :: SomeBuffer any -> SomeTypedArray any Word16
8483getUint16Array buf = js_getUint16Array buf
8584{-# INLINE getUint16Array #-}
8685
87- getFloat32Array :: SomeBuffer any -> I. SomeFloat32Array any
86+ getFloat32Array :: SomeBuffer any -> SomeTypedArray any Float
8887getFloat32Array buf = js_getFloat32Array buf
8988{-# INLINE getFloat32Array #-}
9089
91- getFloat64Array :: SomeBuffer any -> I. SomeFloat64Array any
90+ getFloat64Array :: SomeBuffer any -> SomeTypedArray any Double
9291getFloat64Array buf = js_getFloat64Array buf
9392{-# INLINE getFloat64Array #-}
9493
@@ -180,9 +179,11 @@ unsafeToPtr :: Buffer -> Ptr a
180179unsafeToPtr buf = Ptr (js_toAddr buf)
181180{-# INLINE unsafeToPtr #-}
182181
183- byteLength :: SomeBuffer any -> Int
184- byteLength buf = js_byteLength buf
185- {-# INLINE byteLength #-}
182+ instance ArrayBufferData (SomeBuffer m ) where
183+ {-# INLINE byteLength #-}
184+ byteLength = js_byteLength
185+ {-# INLINE sliceImmutable #-}
186+ sliceImmutable = undefined
186187
187188-- ----------------------------------------------------------------------------
188189
@@ -198,25 +199,25 @@ foreign import javascript unsafe
198199foreign import javascript unsafe
199200 " $1.buf" js_getArrayBuffer :: SomeBuffer any -> SomeArrayBuffer any
200201foreign import javascript unsafe
201- " $1.i3" js_getInt32Array :: SomeBuffer any -> I. SomeInt32Array any
202+ " $1.i3" js_getInt32Array :: SomeBuffer any -> SomeTypedArray any Int32
202203foreign import javascript unsafe
203- " $1.u8" js_getUint8Array :: SomeBuffer any -> I. SomeUint8Array any
204+ " $1.u8" js_getUint8Array :: SomeBuffer any -> SomeTypedArray any Word8
204205foreign import javascript unsafe
205- " $1.u1" js_getUint16Array :: SomeBuffer any -> I. SomeUint16Array any
206+ " $1.u1" js_getUint16Array :: SomeBuffer any -> SomeTypedArray any Word16
206207foreign import javascript unsafe
207- " $1.f3" js_getFloat32Array :: SomeBuffer any -> I. SomeFloat32Array any
208+ " $1.f3" js_getFloat32Array :: SomeBuffer any -> SomeTypedArray any Float
208209foreign import javascript unsafe
209- " $1.f6" js_getFloat64Array :: SomeBuffer any -> I. SomeFloat64Array any
210+ " $1.f6" js_getFloat64Array :: SomeBuffer any -> SomeTypedArray any Double
210211foreign import javascript unsafe
211212 " $1.dv" js_getDataView :: SomeBuffer any -> SomeDataView any
212213
213214-- ----------------------------------------------------------------------------
214215-- these things have the same representation (modulo boxing),
215216-- conversion is free
216217
217- foreign import javascript unsafe
218+ foreign import javascript unsafe
218219 " $r = $1;" js_toByteArray :: SomeBuffer any -> ByteArray #
219- foreign import javascript unsafe
220+ foreign import javascript unsafe
220221 " $r = $1;" js_fromByteArray :: ByteArray # -> JSVal
221222foreign import javascript unsafe
222223 " $r = $1;" js_fromMutableByteArray :: MutableByteArray # s -> JSVal
0 commit comments