Skip to content

Commit a6d1eff

Browse files
committed
Use Int instead of Number
1 parent f7e76d5 commit a6d1eff

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

docs/Node/Buffer.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
#### `Octet`
44

55
``` purescript
6-
type Octet = Number
6+
type Octet = Int
77
```
88

99
#### `Offset`
1010

1111
``` purescript
12-
type Offset = Number
12+
type Offset = Int
1313
```
1414

1515
#### `Buffer`
@@ -75,7 +75,7 @@ fromString :: String -> Encoding -> Buffer
7575
#### `read`
7676

7777
``` purescript
78-
read :: BufferValueType -> Offset -> Buffer -> Number
78+
read :: BufferValueType -> Offset -> Buffer -> Int
7979
```
8080

8181
#### `readString`
@@ -93,13 +93,13 @@ toString :: Encoding -> Buffer -> String
9393
#### `write`
9494

9595
``` purescript
96-
write :: forall e. BufferValueType -> Number -> Offset -> Buffer -> Eff (buffer :: BufferWrite | e) Unit
96+
write :: forall e. BufferValueType -> Int -> Offset -> Buffer -> Eff (buffer :: BufferWrite | e) Unit
9797
```
9898

9999
#### `writeString`
100100

101101
``` purescript
102-
writeString :: forall e. Encoding -> Offset -> Number -> String -> Buffer -> Eff (buffer :: BufferWrite | e) Number
102+
writeString :: forall e. Encoding -> Offset -> Int -> String -> Buffer -> Eff (buffer :: BufferWrite | e) Int
103103
```
104104

105105
#### `toArray`
@@ -123,7 +123,7 @@ setAtOffset :: forall e. Octet -> Offset -> Buffer -> Eff (buffer :: BufferWrite
123123
#### `size`
124124

125125
``` purescript
126-
size :: Buffer -> Number
126+
size :: Buffer -> Int
127127
```
128128

129129
#### `concat`
@@ -135,7 +135,7 @@ concat :: Array Buffer -> Buffer
135135
#### `concat'`
136136

137137
``` purescript
138-
concat' :: Array Buffer -> Number -> Buffer
138+
concat' :: Array Buffer -> Int -> Buffer
139139
```
140140

141141
#### `copy`

docs/Node/Encoding.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ instance showEncoding :: Show Encoding
2121
#### `byteLength`
2222

2323
``` purescript
24-
byteLength :: String -> Encoding -> Number
24+
byteLength :: String -> Encoding -> Int
2525
```
2626

2727

src/Node/Buffer.purs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ import Node.Encoding
3131
-- Type synonym indicating the value should be an octet (0-255). If the value
3232
-- provided is outside this range it will be used as modulo 255.
3333
--
34-
type Octet = Number
34+
type Octet = Int
3535

3636
-- |
3737
-- Type synonym indicating the value refers to an offset in a buffer.
3838
--
39-
type Offset = Number
39+
type Offset = Int
4040

4141
-- |
4242
-- An instance of Node's Buffer class.
@@ -110,10 +110,10 @@ foreign import fromStringImpl :: String -> String -> Buffer
110110
-- |
111111
-- Reads a numeric value from a buffer at the specified offset.
112112
--
113-
read :: BufferValueType -> Offset -> Buffer -> Number
113+
read :: BufferValueType -> Offset -> Buffer -> Int
114114
read = readImpl <<< show
115115

116-
foreign import readImpl :: String -> Offset -> Buffer -> Number
116+
foreign import readImpl :: String -> Offset -> Buffer -> Int
117117

118118
-- |
119119
-- Reads a section of a buffer as a string with the specified encoding.
@@ -134,22 +134,22 @@ foreign import toStringImpl :: String -> Buffer -> String
134134
-- |
135135
-- Writes a numeric value to a buffer at the specified offset.
136136
--
137-
write :: forall e. BufferValueType -> Number -> Offset -> Buffer -> Eff (buffer :: BufferWrite | e) Unit
137+
write :: forall e. BufferValueType -> Int -> Offset -> Buffer -> Eff (buffer :: BufferWrite | e) Unit
138138
write = writeImpl <<< show
139139

140140
foreign import writeImpl ::
141-
forall e. String -> Number -> Offset -> Buffer -> Eff (buffer :: BufferWrite | e) Unit
141+
forall e. String -> Int -> Offset -> Buffer -> Eff (buffer :: BufferWrite | e) Unit
142142

143143
-- |
144144
-- Writes octets from a string to a buffer at the specified offset. Multi-byte
145145
-- characters will not be written to the buffer if there is not enough capacity
146146
-- to write them fully. The number of bytes written is returned.
147147
--
148-
writeString :: forall e. Encoding -> Offset -> Number -> String -> Buffer -> Eff (buffer :: BufferWrite | e) Number
148+
writeString :: forall e. Encoding -> Offset -> Int -> String -> Buffer -> Eff (buffer :: BufferWrite | e) Int
149149
writeString = writeStringImpl <<< show
150150

151151
foreign import writeStringImpl ::
152-
forall e. String -> Offset -> Number -> String -> Buffer -> Eff (buffer :: BufferWrite | e) Number
152+
forall e. String -> Offset -> Int -> String -> Buffer -> Eff (buffer :: BufferWrite | e) Int
153153

154154
-- |
155155
-- Creates an array of octets from a buffer's contents.
@@ -174,7 +174,7 @@ foreign import setAtOffset ::
174174
-- |
175175
-- Returns the size of a buffer.
176176
--
177-
foreign import size :: Buffer -> Number
177+
foreign import size :: Buffer -> Int
178178

179179
-- |
180180
-- Concatenates a list of buffers.
@@ -185,7 +185,7 @@ foreign import concat :: Array Buffer -> Buffer
185185
-- Concatenates a list of buffers, combining them into a new buffer of the
186186
-- specified length.
187187
--
188-
foreign import concat' :: Array Buffer -> Number -> Buffer
188+
foreign import concat' :: Array Buffer -> Int -> Buffer
189189

190190
-- |
191191
-- Copies a section of a source buffer into a target buffer at the specified

src/Node/Encoding.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ instance showEncoding :: Show Encoding where
2323
show Binary = "binary"
2424
show Hex = "hex"
2525

26-
foreign import byteLengthImpl :: String -> String -> Number
26+
foreign import byteLengthImpl :: String -> String -> Int
2727

28-
byteLength :: String -> Encoding -> Number
28+
byteLength :: String -> Encoding -> Int
2929
byteLength str enc = byteLengthImpl str (show enc)

0 commit comments

Comments
 (0)