Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: node_js
sudo: false
node_js:
- 0.10
- 0.12
- 4.1
env:
- PATH=$HOME/purescript:$PATH
Expand All @@ -11,6 +9,7 @@ install:
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
- chmod a+x $HOME/purescript
- npm install -g bower
- npm install
script:
- npm run build
10 changes: 5 additions & 5 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"url": "git://github.com/purescript-node/purescript-node-buffer"
},
"dependencies": {
"purescript-eff": "~0.1.0",
"purescript-maybe": "~0.3.1"
"purescript-eff": "^1.0.0",
"purescript-maybe": "^1.0.0"
},
"devDependencies": {
"purescript-assert": "~0.1.1",
"purescript-console": "~0.1.1",
"purescript-foldable-traversable": "~0.4.1"
"purescript-assert": "^1.0.0",
"purescript-console": "^1.0.0",
"purescript-foldable-traversable": "^1.0.0"
}
}
4 changes: 2 additions & 2 deletions docs/Node/Buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ An instance of Node's Buffer class.

##### Instances
``` purescript
instance showBuffer :: Show Buffer
Show Buffer
```

#### `BUFFER`
Expand Down Expand Up @@ -62,7 +62,7 @@ Enumeration of the numeric types that can be written to a buffer.

##### Instances
``` purescript
instance showBufferValueType :: Show BufferValueType
Show BufferValueType
```

#### `create`
Expand Down
5 changes: 5 additions & 0 deletions docs/Node/Buffer/Unsafe.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@
slice :: Offset -> Offset -> Buffer -> Buffer
```

Creates a new buffer slice that acts like a window on the original buffer.
Writing to the slice buffer updates the original buffer and vice-versa.
This is considered unsafe as writing to a slice can result in action at a
distance.


2 changes: 1 addition & 1 deletion docs/Node/Encoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ data Encoding

##### Instances
``` purescript
instance showEncoding :: Show Encoding
Show Encoding
```

#### `byteLength`
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"private": true,
"devDependencies": {
"pulp": "^4.0.1",
"pulp": "^9.0.0",
"rimraf": "^2.4.1"
},
"scripts": {
"postinstall": "pulp dep install",
"postinstall": "bower install",
"build": "pulp build && pulp test && rimraf docs && pulp docs"
}
}
2 changes: 0 additions & 2 deletions src/Node/Buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
/* global require */
"use strict";

// module Node.Buffer

exports.showImpl = require('util').inspect;

exports.create = function (size) {
Expand Down
6 changes: 3 additions & 3 deletions src/Node/Buffer.purs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ module Node.Buffer
) where

import Prelude
import Control.Monad.Eff
import Data.Maybe
import Node.Encoding
import Control.Monad.Eff (Eff)
import Data.Maybe (Maybe(..))
import Node.Encoding (Encoding)

-- | Type synonym indicating the value should be an octet (0-255). If the value
-- | provided is outside this range it will be used as modulo 255.
Expand Down
2 changes: 0 additions & 2 deletions src/Node/Buffer/Unsafe.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
/* global Buffer */
"use strict";

// module Node.Buffer.Unsafe

exports.slice = function (start) {
return function (end) {
return function (buff) {
Expand Down
2 changes: 0 additions & 2 deletions src/Node/Encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
/* global Buffer */
"use strict";

// module Node.Encoding

exports.byteLengthImpl = function (str) {
return function (enc) {
return Buffer.byteLength(str, enc);
Expand Down
15 changes: 7 additions & 8 deletions test/Main.purs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
module Test.Main where

import Prelude
import Data.Traversable (traverse)
import Control.Monad.Eff
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (log, CONSOLE())
import Test.Assert

import Node.Buffer
import Node.Encoding
import Data.Traversable (traverse)
import Node.Buffer (BUFFER, BufferValueType(..), toArray, concat', fromArray, fill, copy, readString, fromString, toString, read, write, create)
import Node.Encoding (Encoding(..))
import Test.Assert (ASSERT, assert')

type Test = forall e. Eff (assert :: ASSERT, buffer :: BUFFER, console :: CONSOLE | e) Unit

Expand Down Expand Up @@ -124,6 +123,6 @@ testConcat' = do
assertEq :: forall a. (Eq a, Show a) => a -> a -> Test
assertEq x y =
if x == y
then return unit
else let msg = show x ++ " and " ++ show y ++ " were not equal."
then pure unit
else let msg = show x <> " and " <> show y <> " were not equal."
in assert' msg false