Skip to content

Commit 0c4f7c1

Browse files
committed
Remove EffTest, s/eff/e
2 parents 0243e2d + 642ae7d commit 0c4f7c1

File tree

1 file changed

+25
-27
lines changed

1 file changed

+25
-27
lines changed

test/Main.purs

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ foldableLength = unwrap <<< foldMap (const (Additive 1))
3232
deferEff :: forall e a. (Unit -> a) -> Eff e a
3333
deferEff = unsafeCoerce
3434

35-
type EffTest a = forall e. Eff (assert :: ASSERT | e) a
36-
3735
main :: Eff (assert :: ASSERT, console :: CONSOLE) Unit
3836
main = do
3937
log "Test foldableArray instance"
@@ -54,7 +52,7 @@ main = do
5452
testFoldableFoldlDefault 20
5553

5654
log "Test foldrDefault"
57-
testFoldableFoldlDefault 20
55+
testFoldableFoldrDefault 20
5856

5957
foreachE [1,2,3,4,5,10,20] \i -> do
6058
log $ "Test traversableArray instance with an array of size: " <> show i
@@ -167,12 +165,12 @@ main = do
167165

168166

169167
testFoldableFWith
170-
:: forall f
168+
:: forall f e
171169
. Foldable f
172170
=> Eq (f Int)
173171
=> (Int -> f Int)
174172
-> Int
175-
-> EffTest Unit
173+
-> Eff (assert :: ASSERT | e) Unit
176174
testFoldableFWith f n = do
177175
let dat = f n
178176
let expectedSum = (n / 2) * (n + 1)
@@ -181,16 +179,16 @@ testFoldableFWith f n = do
181179
assert $ foldl (+) 0 dat == expectedSum
182180
assert $ foldMap Additive dat == Additive expectedSum
183181

184-
testFoldableArrayWith :: Int -> EffTest Unit
182+
testFoldableArrayWith :: forall e. Int -> Eff (assert :: ASSERT | e) Unit
185183
testFoldableArrayWith = testFoldableFWith arrayFrom1UpTo
186184

187185
testFoldableWithIndexFWith
188-
:: forall f
186+
:: forall f e
189187
. FoldableWithIndex Int f
190188
=> Eq (f Int)
191189
=> (Int -> f Int)
192190
-> Int
193-
-> EffTest Unit
191+
-> Eff (assert :: ASSERT | e) Unit
194192
testFoldableWithIndexFWith f n = do
195193
let dat = f n
196194
-- expectedSum = \Sum_{1 <= i <= n} i * i
@@ -200,7 +198,7 @@ testFoldableWithIndexFWith f n = do
200198
assert $ foldlWithIndex (\i y x -> y + (i + 1) * x) 0 dat == expectedSum
201199
assert $ foldMapWithIndex (\i x -> Additive $ (i + 1) * x) dat == Additive expectedSum
202200

203-
testFoldableWithIndexArrayWith :: Int -> EffTest Unit
201+
testFoldableWithIndexArrayWith :: forall e. Int -> Eff (assert :: ASSERT | e) Unit
204202
testFoldableWithIndexArrayWith = testFoldableWithIndexFWith arrayFrom1UpTo
205203

206204

@@ -209,7 +207,7 @@ derive instance eqTuple :: (Eq a, Eq b) => Eq (Tuple a b)
209207

210208
-- test whether foldable laws hold, using foldMap and ifoldMap
211209
testFoldableWithIndexLawsOn
212-
:: forall f i a m n
210+
:: forall f i a m n e
213211
. FoldableWithIndex i f
214212
=> FunctorWithIndex i f
215213
=> Monoid m
@@ -219,7 +217,7 @@ testFoldableWithIndexLawsOn
219217
=> f a
220218
-> (i -> a -> m)
221219
-> (a -> n)
222-
-> EffTest Unit
220+
-> Eff (assert :: ASSERT | e) Unit
223221
testFoldableWithIndexLawsOn c f g = do
224222
-- compatibility with FunctorWithIndex (not strictly necessary for a valid
225223
-- instance, but it's likely an error if this does not hold)
@@ -238,12 +236,12 @@ testFoldableWithIndexLawsOn c f g = do
238236
assert $ foldMapWithIndex f c == foldrWithIndexDefault (\i x y -> f i x <> y) mempty c
239237

240238
testTraversableFWith
241-
:: forall f
239+
:: forall f e
242240
. Traversable f
243241
=> Eq (f Int)
244242
=> (Int -> f Int)
245243
-> Int
246-
-> EffTest Unit
244+
-> Eff (assert :: ASSERT | e) Unit
247245
testTraversableFWith f n = do
248246
let dat = f n
249247
let len = foldableLength dat
@@ -266,17 +264,17 @@ testTraversableFWith f n = do
266264
assert' "underlying applicative" $
267265
(traverse pure dat :: Unit -> f Int) unit == dat
268266

269-
testTraversableArrayWith :: Int -> EffTest Unit
267+
testTraversableArrayWith :: forall e. Int -> Eff (assert :: ASSERT | e) Unit
270268
testTraversableArrayWith = testTraversableFWith arrayFrom1UpTo
271269

272270
testTraversableWithIndexFWith
273-
:: forall f
271+
:: forall f e
274272
. TraversableWithIndex Int f
275273
=> Eq (f (Tuple Int Int))
276274
=> Eq (f Int)
277275
=> (Int -> f Int)
278276
-> Int
279-
-> EffTest Unit
277+
-> Eff (assert :: ASSERT | e) Unit
280278
testTraversableWithIndexFWith f n = do
281279
let dat = f n
282280

@@ -288,7 +286,7 @@ testTraversableWithIndexFWith f n = do
288286
traverse pure dat
289287

290288
testTraversableWithIndexArrayWith
291-
:: Int -> EffTest Unit
289+
:: forall e. Int -> Eff (assert :: ASSERT | e) Unit
292290
testTraversableWithIndexArrayWith = testTraversableWithIndexFWith arrayFrom1UpTo
293291

294292
-- structures for testing default `Foldable` implementations
@@ -327,16 +325,16 @@ instance foldableDFR :: Foldable FoldrDefault where
327325
foldl f u (FRD a) = foldl f u a
328326
foldr f u = foldrDefault f u
329327

330-
testFoldableFoldMapDefaultL :: Int -> EffTest Unit
328+
testFoldableFoldMapDefaultL :: forall e. Int -> Eff (assert :: ASSERT | e) Unit
331329
testFoldableFoldMapDefaultL = testFoldableFWith (FML <<< arrayFrom1UpTo)
332330

333-
testFoldableFoldMapDefaultR :: Int -> EffTest Unit
331+
testFoldableFoldMapDefaultR :: forall e. Int -> Eff (assert :: ASSERT | e) Unit
334332
testFoldableFoldMapDefaultR = testFoldableFWith (FMR <<< arrayFrom1UpTo)
335333

336-
testFoldableFoldlDefault :: Int -> EffTest Unit
334+
testFoldableFoldlDefault :: forall e. Int -> Eff (assert :: ASSERT | e) Unit
337335
testFoldableFoldlDefault = testFoldableFWith (FLD <<< arrayFrom1UpTo)
338336

339-
testFoldableFoldrDefault :: Int -> EffTest Unit
337+
testFoldableFoldrDefault :: forall e. Int -> Eff (assert :: ASSERT | e) Unit
340338
testFoldableFoldrDefault = testFoldableFWith (FRD <<< arrayFrom1UpTo)
341339

342340

@@ -369,10 +367,10 @@ instance traversableSD :: Traversable SequenceDefault where
369367
traverse f (SD a) = map SD (traverse f a)
370368
sequence m = sequenceDefault m
371369

372-
testTraverseDefault :: Int -> EffTest Unit
370+
testTraverseDefault :: forall e. Int -> Eff (assert :: ASSERT | e) Unit
373371
testTraverseDefault = testTraversableFWith (TD <<< arrayFrom1UpTo)
374372

375-
testSequenceDefault :: Int -> EffTest Unit
373+
testSequenceDefault :: forall e. Int -> Eff (assert :: ASSERT | e) Unit
376374
testSequenceDefault = testTraversableFWith (SD <<< arrayFrom1UpTo)
377375

378376

@@ -414,14 +412,14 @@ instance bitraversableIOr :: Bitraversable IOr where
414412
bisequence (Snd snd) = Snd <$> snd
415413

416414
testBifoldableIOrWith
417-
:: forall t
415+
:: forall t e
418416
. Bifoldable t
419417
=> Eq (t Int Int)
420418
=> (forall l r. IOr l r -> t l r)
421419
-> Int
422420
-> Int
423421
-> Int
424-
-> EffTest Unit
422+
-> Eff (assert :: ASSERT | e) Unit
425423
testBifoldableIOrWith lift fst snd u = do
426424
assert $ bifoldr (+) (*) u (lift $ Both fst snd) == fst + (snd * u)
427425
assert $ bifoldr (+) (*) u (lift $ Fst fst) == fst + u
@@ -436,11 +434,11 @@ testBifoldableIOrWith lift fst snd u = do
436434
assert $ bifoldMap Additive Additive (lift $ Snd snd) == Additive snd
437435

438436
testBitraversableIOrWith
439-
:: forall t
437+
:: forall t e
440438
. Bitraversable t
441439
=> Eq (t Boolean Boolean)
442440
=> (forall l r. IOr l r -> t l r)
443-
-> EffTest Unit
441+
-> Eff (assert :: ASSERT | e) Unit
444442
testBitraversableIOrWith lift = do
445443
let just a = Just (lift a)
446444
assert $ bisequence (lift (Both (Just true) (Just false))) == just (Both true false)

0 commit comments

Comments
 (0)