Skip to content

Commit e06a9a2

Browse files
committed
Merge branch 'v10' of git://github.com/jacereda/purescript-arraybuffer into redesign
2 parents fa85219 + 86fd6e8 commit e06a9a2

File tree

13 files changed

+551
-261
lines changed

13 files changed

+551
-261
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ ArrayBuffer bindings for PureScript.
1212
## Documentation
1313

1414
Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-arraybuffer).
15+
16+
See https://github.com/AlexaDeWit/purescript-arraybuffer-codecs if you need text/base64 encoding/decoding functions.

bower.json

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"purescript-debug": "^4.0.0",
2828
"purescript-quickcheck": "^5.0.0",
2929
"purescript-partial": "^2.0.0",
30-
"purescript-unicode": "^4.0.1",
3130
"purescript-quickcheck-combinators": "^0.1.0"
3231
}
3332
}

src/Data/ArrayBuffer/ArrayBuffer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// module Data.ArrayBuffer.ArrayBuffer
44

5-
exports.empty = function empty (s) {
5+
exports.emptyImpl = function empty (s) {
66
return new ArrayBuffer(s);
77
};
88

src/Data/ArrayBuffer/ArrayBuffer.purs

+7-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@ import Data.Function.Uncurried (Fn3, runFn3)
1212
import Data.Maybe (Maybe(..))
1313
import Data.Nullable (Nullable, notNull, null)
1414
import Data.Tuple (Tuple(..))
15+
import Effect (Effect)
16+
import Effect.Uncurried (EffectFn1, runEffectFn1)
17+
18+
19+
foreign import emptyImpl :: EffectFn1 ByteLength ArrayBuffer
1520

1621

1722
-- | Create an `ArrayBuffer` with the given capacity.
18-
foreign import empty :: ByteLength -> ArrayBuffer
23+
empty :: ByteLength -> Effect ArrayBuffer
24+
empty l = runEffectFn1 emptyImpl l
1925

2026
-- | Represents the length of an `ArrayBuffer` in bytes.
2127
foreign import byteLength :: ArrayBuffer -> ByteLength

src/Data/ArrayBuffer/ArrayBuffer/Gen.purs

+3-6
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@ module Data.ArrayBuffer.ArrayBuffer.Gen where
33
import Control.Monad.Gen.Class (class MonadGen)
44
import Data.ArrayBuffer.Typed (buffer)
55
import Data.ArrayBuffer.Typed.Gen (genTypedArray, genUint8)
6-
import Data.ArrayBuffer.Types (ArrayBuffer, ByteLength, Uint8Array)
7-
import Data.Maybe (Maybe)
6+
import Data.ArrayBuffer.Types (ArrayBuffer, Uint8Array)
87
import Prelude ((<$>))
98

109

1110
genArrayBuffer :: forall m
1211
. MonadGen m
13-
=> ByteLength -- ^ Min length
14-
-> Maybe ByteLength -- ^ Max length
15-
-> m ArrayBuffer
16-
genArrayBuffer a b = buffer <$> (genTypedArray a b genUint8 :: m Uint8Array)
12+
=> m ArrayBuffer
13+
genArrayBuffer = buffer <$> (genTypedArray genUint8 :: m Uint8Array)

src/Data/ArrayBuffer/DataView.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ exports.getterImpl = function getterImpl (data, v, o) {
3333
: data.nothing;
3434
};
3535

36-
exports.setterImpl = function setterImpl (data,v,n,o) {
36+
exports.setterImpl = function setterImpl (data, v, o, n) {
3737
if (((o + data.bytesPerValue) >>> 0) <= v.byteLength) {
3838
v[data.functionName].call(v,o,n,data.littleEndian);
3939
return true;

0 commit comments

Comments
 (0)