1
1
module Test.Main where
2
2
3
3
import Prelude
4
- import Control.Monad.Eff (Eff )
4
+ import Control.Monad.Eff (Eff , kind Effect )
5
5
import Control.Monad.Eff.Console (CONSOLE , log )
6
6
import Control.Monad.Eff.Exception (EXCEPTION )
7
7
import Node.Encoding (Encoding (..))
@@ -12,11 +12,11 @@ import Data.Either (Either(..))
12
12
import Data.Maybe (Maybe (..), fromJust , isNothing , isJust )
13
13
import Partial.Unsafe (unsafePartial )
14
14
15
- assertEqual :: forall e a . ( Show a , Eq a ) => a -> a -> Eff (assert :: ASSERT | e ) Unit
15
+ assertEqual :: forall e a . Show a => Eq a => a -> a -> Eff (assert :: ASSERT | e ) Unit
16
16
assertEqual x y =
17
17
assert' (show x <> " did not equal " <> show y) (x == y)
18
18
19
- foreign import data STREAM_BUFFER :: !
19
+ foreign import data STREAM_BUFFER :: Effect
20
20
21
21
foreign import writableStreamBuffer :: forall eff . Eff (sb :: STREAM_BUFFER | eff ) (Writable () (sb :: STREAM_BUFFER | eff ))
22
22
34
34
. Eff ( console :: CONSOLE
35
35
, sb :: STREAM_BUFFER
36
36
, assert :: ASSERT
37
- , err :: EXCEPTION
37
+ , exception :: EXCEPTION
38
38
, buffer :: Buffer.BUFFER
39
39
, stream :: PASS_THROUGH
40
40
, gzip :: GZIP
41
41
| eff ) Boolean
42
42
main = do
43
43
log " setDefaultEncoding should not affect writing"
44
- testSetDefaultEncoding
44
+ _ <- testSetDefaultEncoding
45
45
46
46
log " setEncoding should not affect reading"
47
47
testSetEncoding
48
48
49
49
log " test pipe"
50
- testPipe
50
+ _ <- testPipe
51
51
52
52
log " test manual reads"
53
53
testReads
@@ -58,12 +58,12 @@ testString = "üöß💡"
58
58
testReads
59
59
:: forall eff
60
60
. Eff ( stream :: PASS_THROUGH
61
- , err :: EXCEPTION
61
+ , exception :: EXCEPTION
62
62
, buffer :: Buffer.BUFFER
63
63
, assert :: ASSERT
64
64
| eff ) Boolean
65
65
testReads = do
66
- testReadString
66
+ _ <- testReadString
67
67
testReadBuf
68
68
69
69
where
@@ -89,7 +89,7 @@ testReads = do
89
89
onReadable sIn do
90
90
buf <- read sIn Nothing
91
91
assert (isJust buf)
92
- assertEqual <$> (Buffer .toString UTF8 (unsafePartial (fromJust buf)))
92
+ _ <- assertEqual <$> (Buffer .toString UTF8 (unsafePartial (fromJust buf)))
93
93
<*> pure testString
94
94
pure unit
95
95
@@ -103,7 +103,7 @@ testSetDefaultEncoding
103
103
| eff ) Boolean
104
104
testSetDefaultEncoding = do
105
105
w1 <- writableStreamBuffer
106
- check w1
106
+ _ <- check w1
107
107
108
108
w2 <- writableStreamBuffer
109
109
setDefaultEncoding w2 UCS2
@@ -118,7 +118,7 @@ testSetDefaultEncoding = do
118
118
testSetEncoding
119
119
:: forall eff
120
120
. Eff ( sb :: STREAM_BUFFER
121
- , err :: EXCEPTION
121
+ , exception :: EXCEPTION
122
122
, buffer :: Buffer.BUFFER
123
123
, assert :: ASSERT
124
124
| eff ) Unit
@@ -137,14 +137,14 @@ testSetEncoding = do
137
137
138
138
onData r1 \buf -> unsafePartial do
139
139
onDataEither r2 \(Left str) -> do
140
- assertEqual <$> Buffer .toString enc buf <*> pure testString
140
+ _ <- assertEqual <$> Buffer .toString enc buf <*> pure testString
141
141
assertEqual str testString
142
142
143
143
testPipe
144
144
:: forall eff
145
145
. Eff ( stream :: PASS_THROUGH
146
146
, gzip :: GZIP
147
- , err :: EXCEPTION
147
+ , exception :: EXCEPTION
148
148
, assert :: ASSERT
149
149
, console :: CONSOLE
150
150
| eff ) Boolean
@@ -155,23 +155,23 @@ testPipe = do
155
155
unzip <- createGunzip
156
156
157
157
log " pipe 1"
158
- sIn `pipe` zip
158
+ _ <- sIn `pipe` zip
159
159
log " pipe 2"
160
- zip `pipe` unzip
160
+ _ <- zip `pipe` unzip
161
161
log " pipe 3"
162
- unzip `pipe` sOut
162
+ _ <- unzip `pipe` sOut
163
163
164
164
writeString sIn UTF8 testString do
165
165
end sIn do
166
166
onDataString sOut UTF8 \str -> do
167
167
assertEqual str testString
168
168
169
- foreign import data GZIP :: !
169
+ foreign import data GZIP :: Effect
170
170
171
171
foreign import createGzip :: forall eff . Eff (gzip :: GZIP | eff ) (Duplex (gzip :: GZIP | eff ))
172
172
foreign import createGunzip :: forall eff . Eff (gzip :: GZIP | eff ) (Duplex (gzip :: GZIP | eff ))
173
173
174
- foreign import data PASS_THROUGH :: !
174
+ foreign import data PASS_THROUGH :: Effect
175
175
176
176
-- | Create a PassThrough stream, which simply writes its input to its output.
177
177
foreign import passThrough :: forall eff . Eff (stream :: PASS_THROUGH | eff ) (Duplex (stream :: PASS_THROUGH | eff ))
0 commit comments