Skip to content

Commit 41098f0

Browse files
committed
0.12 updates
bumped deps use Effect instead of Eff fix travis
1 parent ef44e27 commit 41098f0

File tree

5 files changed

+49
-49
lines changed

5 files changed

+49
-49
lines changed

.travis.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
language: node_js
22
dist: trusty
33
sudo: required
4-
node_js: 6
4+
node_js: stable
55
install:
6+
- TAG=$(wget -q -O - https://github.com/purescript/purescript/releases/latest --server-response --max-redirect 0 2>&1 | sed -n -e 's/.*Location:.*tag\///p')
7+
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
8+
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
9+
- chmod a+x $HOME/purescript
610
- npm install -g bower
711
- npm install
8-
- bower install
912
script:
13+
- bower install --production
1014
- npm run -s build
15+
- bower install
16+
- npm -s test
1117
after_success:
1218
- >-
1319
test $TRAVIS_TAG &&

bower.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
"url": "git://github.com/purescript-node/purescript-node-buffer"
1414
},
1515
"dependencies": {
16-
"purescript-eff": "^3.0.0",
17-
"purescript-maybe": "^3.0.0",
16+
"purescript-effect": "#compiler/0.12",
17+
"purescript-maybe": "#compiler/0.12",
1818
"purescript-arraybuffer-types": "^2.0.0"
1919
},
2020
"devDependencies": {
21-
"purescript-assert": "^3.0.0",
22-
"purescript-console": "^3.0.0",
23-
"purescript-foldable-traversable": "^3.0.0"
21+
"purescript-assert": "#compiler/0.12",
22+
"purescript-console": "#compiler/0.12",
23+
"purescript-foldable-traversable": "#compiler/0.12"
2424
}
2525
}

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"private": true,
44
"scripts": {
55
"clean": "rimraf output && rimraf .pulp-cache",
6-
"build": "pulp build -- --censor-lib --strict"
6+
"build": "pulp build -- --censor-lib --strict",
7+
"test": "pulp test --check-main-type Effect.Effect"
78
},
89
"devDependencies": {
9-
"pulp": "^11.0.0",
10-
"purescript-psa": "^0.5.0",
11-
"purescript": "^0.11.1",
12-
"rimraf": "^2.6.1"
10+
"pulp": "^12.0.1",
11+
"purescript-psa": "^0.6.0",
12+
"rimraf": "^2.6.2"
1313
}
1414
}

src/Node/Buffer.purs

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ module Node.Buffer
22
( Octet()
33
, Offset()
44
, Buffer()
5-
, BUFFER()
65
, BufferValueType(..)
76
, create
87
, fromArray
@@ -26,7 +25,7 @@ module Node.Buffer
2625

2726
import Prelude
2827

29-
import Control.Monad.Eff (Eff, kind Effect)
28+
import Effect (Effect)
3029
import Data.ArrayBuffer.Types (ArrayBuffer)
3130
import Data.Maybe (Maybe(..))
3231
import Node.Encoding (Encoding, encodingToNode)
@@ -46,9 +45,6 @@ instance showBuffer :: Show Buffer where
4645

4746
foreign import showImpl :: Buffer -> String
4847

49-
-- | Effect for buffer creation, reading, or writing.
50-
foreign import data BUFFER :: Effect
51-
5248
-- | Enumeration of the numeric types that can be written to a buffer.
5349
data BufferValueType
5450
= UInt8
@@ -83,88 +79,86 @@ instance showBufferValueType :: Show BufferValueType where
8379
show DoubleBE = "DoubleBE"
8480

8581
-- | Creates a new buffer of the specified size.
86-
foreign import create :: forall e. Int -> Eff (buffer :: BUFFER | e) Buffer
82+
foreign import create :: Int -> Effect Buffer
8783

8884
-- | Creates a new buffer from an array of octets, sized to match the array.
89-
foreign import fromArray :: forall e. Array Octet -> Eff (buffer :: BUFFER | e) Buffer
85+
foreign import fromArray :: Array Octet -> Effect Buffer
9086

9187
-- | Creates a buffer view from a JS ArrayByffer without copying data.
9288
--
9389
-- Requires Node >= v5.10.0
94-
foreign import fromArrayBuffer :: forall e. ArrayBuffer -> Eff (buffer :: BUFFER | e) Buffer
90+
foreign import fromArrayBuffer :: ArrayBuffer -> Effect Buffer
9591

9692
-- | Creates a new buffer from a string with the specified encoding, sized to
9793
-- | match the string.
98-
fromString :: forall e. String -> Encoding -> Eff (buffer :: BUFFER | e) Buffer
94+
fromString :: String -> Encoding -> Effect Buffer
9995
fromString str = fromStringImpl str <<< encodingToNode
10096

101-
foreign import fromStringImpl :: forall e. String -> String -> Eff (buffer :: BUFFER | e) Buffer
97+
foreign import fromStringImpl :: String -> String -> Effect Buffer
10298

103-
foreign import toArrayBuffer :: forall e. Buffer -> Eff (buffer :: BUFFER | e) ArrayBuffer
99+
foreign import toArrayBuffer :: Buffer -> Effect ArrayBuffer
104100

105101
-- | Reads a numeric value from a buffer at the specified offset.
106-
read :: forall e. BufferValueType -> Offset -> Buffer -> Eff (buffer :: BUFFER | e) Int
102+
read :: BufferValueType -> Offset -> Buffer -> Effect Int
107103
read = readImpl <<< show
108104

109-
foreign import readImpl :: forall e. String -> Offset -> Buffer -> Eff (buffer :: BUFFER | e) Int
105+
foreign import readImpl :: String -> Offset -> Buffer -> Effect Int
110106

111107
-- | Reads a section of a buffer as a string with the specified encoding.
112-
readString :: forall e. Encoding -> Offset -> Offset -> Buffer -> Eff (buffer :: BUFFER | e) String
108+
readString :: Encoding -> Offset -> Offset -> Buffer -> Effect String
113109
readString = readStringImpl <<< encodingToNode
114110

115111
foreign import readStringImpl ::
116-
forall e. String -> Offset -> Offset -> Buffer -> Eff (buffer :: BUFFER | e) String
112+
String -> Offset -> Offset -> Buffer -> Effect String
117113

118114
-- | Reads the buffer as a string with the specified encoding.
119-
toString :: forall e. Encoding -> Buffer -> Eff (buffer :: BUFFER | e) String
115+
toString :: Encoding -> Buffer -> Effect String
120116
toString = toStringImpl <<< encodingToNode
121117

122-
foreign import toStringImpl :: forall e. String -> Buffer -> Eff (buffer :: BUFFER | e) String
118+
foreign import toStringImpl :: String -> Buffer -> Effect String
123119

124120
-- | Writes a numeric value to a buffer at the specified offset.
125-
write :: forall e. BufferValueType -> Int -> Offset -> Buffer -> Eff (buffer :: BUFFER | e) Unit
121+
write :: BufferValueType -> Int -> Offset -> Buffer -> Effect Unit
126122
write = writeImpl <<< show
127123

128-
foreign import writeImpl ::
129-
forall e. String -> Int -> Offset -> Buffer -> Eff (buffer :: BUFFER | e) Unit
124+
foreign import writeImpl :: String -> Int -> Offset -> Buffer -> Effect Unit
130125

131126
-- | Writes octets from a string to a buffer at the specified offset. Multi-byte
132127
-- | characters will not be written to the buffer if there is not enough capacity
133128
-- | to write them fully. The number of bytes written is returned.
134-
writeString :: forall e. Encoding -> Offset -> Int -> String -> Buffer -> Eff (buffer :: BUFFER | e) Int
129+
writeString :: Encoding -> Offset -> Int -> String -> Buffer -> Effect Int
135130
writeString = writeStringImpl <<< encodingToNode
136131

137132
foreign import writeStringImpl ::
138-
forall e. String -> Offset -> Int -> String -> Buffer -> Eff (buffer :: BUFFER | e) Int
133+
String -> Offset -> Int -> String -> Buffer -> Effect Int
139134

140135
-- | Creates an array of octets from a buffer's contents.
141-
foreign import toArray :: forall e. Buffer -> Eff (buffer :: BUFFER | e) (Array Octet)
136+
foreign import toArray :: Buffer -> Effect (Array Octet)
142137

143138
-- | Reads an octet from a buffer at the specified offset.
144-
getAtOffset :: forall e. Offset -> Buffer -> Eff (buffer :: BUFFER | e) (Maybe Octet)
139+
getAtOffset :: Offset -> Buffer -> Effect (Maybe Octet)
145140
getAtOffset = getAtOffsetImpl Just Nothing
146141

147142
foreign import getAtOffsetImpl ::
148-
forall e. (Octet -> Maybe Octet) -> Maybe Octet -> Offset -> Buffer -> Eff (buffer :: BUFFER | e) (Maybe Octet)
143+
(Octet -> Maybe Octet) -> Maybe Octet -> Offset -> Buffer -> Effect (Maybe Octet)
149144

150145
-- | Writes an octet in the buffer at the specified offset.
151-
foreign import setAtOffset ::
152-
forall e. Octet -> Offset -> Buffer -> Eff (buffer :: BUFFER | e) Unit
146+
foreign import setAtOffset :: Octet -> Offset -> Buffer -> Effect Unit
153147

154148
-- | Returns the size of a buffer.
155-
foreign import size :: forall e. Buffer -> Eff (buffer :: BUFFER | e) Int
149+
foreign import size :: Buffer -> Effect Int
156150

157151
-- | Concatenates a list of buffers.
158-
foreign import concat :: forall e. Array Buffer -> Eff (buffer :: BUFFER | e) Buffer
152+
foreign import concat :: Array Buffer -> Effect Buffer
159153

160154
-- | Concatenates a list of buffers, combining them into a new buffer of the
161155
-- | specified length.
162-
foreign import concat' :: forall e. Array Buffer -> Int -> Eff (buffer :: BUFFER | e) Buffer
156+
foreign import concat' :: Array Buffer -> Int -> Effect Buffer
163157

164158
-- | Copies a section of a source buffer into a target buffer at the specified
165159
-- | offset, and returns the number of octets copied.
166-
foreign import copy :: forall e. Offset -> Offset -> Buffer -> Offset -> Buffer -> Eff (buffer :: BUFFER | e) Int
160+
foreign import copy :: Offset -> Offset -> Buffer -> Offset -> Buffer -> Effect Int
167161

168162
-- | Fills a range in a buffer with the specified octet.
169163
foreign import fill ::
170-
forall e. Octet -> Offset -> Offset -> Buffer -> Eff (buffer :: BUFFER | e) Unit
164+
Octet -> Offset -> Offset -> Buffer -> Effect Unit

test/Main.purs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
module Test.Main where
22

33
import Prelude
4-
import Control.Monad.Eff (Eff)
5-
import Control.Monad.Eff.Console (log, CONSOLE())
4+
import Effect (Effect)
5+
import Effect.Console (log)
66
import Data.Maybe (Maybe(..))
77
import Data.Traversable (traverse)
8-
import Node.Buffer (BUFFER, BufferValueType(..), toArray, concat', fromArray, fill, copy, readString, fromString, toString, read, write, create, getAtOffset)
8+
import Node.Buffer (BufferValueType(..), toArray, concat', fromArray, fill, copy, readString, fromString, toString, read, write, create, getAtOffset)
99
import Node.Encoding (Encoding(..))
10-
import Test.Assert (ASSERT, assert')
10+
import Test.Assert (assert')
1111

12-
type Test = forall e. Eff (assert :: ASSERT, buffer :: BUFFER, console :: CONSOLE | e) Unit
12+
type Test = Effect Unit
1313

1414
main :: Test
1515
main = do

0 commit comments

Comments
 (0)