@@ -1,15 +1,15 @@
11module Test.LinearAlgebra.Matrix (testMatrix) where
22
33import Prelude
4−import Control.Monad.Eff (Eff)
5−import Control.Monad.Eff.Console (log, CONSOLE)
4+import Effect (Effect)
5+import Effect.Class.Console (log)
66import Data.Maybe (Maybe(..), fromMaybe, isJust, isNothing)
7−import Test.Assert (assert, ASSERT)
7+import Test.Assert (assert)
88
99import LinearAlgebra.Matrix as M
1010
1111
12−testMatrix :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
12+testMatrix :: Effect Unit
1313testMatrix = do
1414 log "\n# Test Matrix"
1515 testCreate
@@ -28,7 +28,7 @@ testMatrix = do
2828 testIdentity
2929
3030
31−testCreate :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
31+testCreate :: Effect Unit
3232testCreate = do
3333 log " * Create matrix"
3434 let z1 = M.zeros 5 4
@@ -36,49 +36,49 @@ testCreate = do
3636 assert $ M.ncols z1 == 4
3737
3838
39−testFromArray :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
39+testFromArray :: Effect Unit
4040testFromArray = do
4141 log " * From Array"
4242 assert $ isNothing (M.fromArray 2 3 [1.0])
4343 assert $ isJust (M.fromArray 2 3 [1.0, 2.0, 3.0, 4.0, 5.0, 6.0])
4444
4545
46−testGetRow :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
46+testGetRow :: Effect Unit
4747testGetRow = do
4848 log " * Get specific row"
4949 let mat = fromMaybe (M.zeros 1 1) $ M.fromArray 2 3 [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
5050 assert $ M.row 0 mat == [1.0, 2.0, 3.0]
5151
5252
53−testGetCol :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
53+testGetCol :: Effect Unit
5454testGetCol = do
5555 log " * Get specific column"
5656 let mat = fromMaybe (M.zeros 1 1) $ M.fromArray 2 3 [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
5757 assert $ M.column 1 mat == [2.0, 5.0]
5858
5959
60−testGetValue :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
60+testGetValue :: Effect Unit
6161testGetValue = do
6262 log " * Get specific value"
6363 let mat = fromMaybe (M.zeros 1 1) $ M.fromArray 2 3 [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
6464 assert $ M.element 1 2 mat == Just 6.0
6565
6666
67−testRows :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
67+testRows :: Effect Unit
6868testRows = do
6969 log " * Get list of rows"
7070 let mat = fromMaybe (M.zeros 1 1) $ M.fromArray 2 3 [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
7171 assert $ M.rows mat == [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]
7272
7373
74−testColumns :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
74+testColumns :: Effect Unit
7575testColumns = do
7676 log " * Get list of columns"
7777 let mat = fromMaybe (M.zeros 1 1) $ M.fromArray 2 3 [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
7878 assert $ M.columns mat == [[1.0, 4.0], [2.0, 5.0], [3.0, 6.0]]
7979
8080
81−testSliceColumns :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
81+testSliceColumns :: Effect Unit
8282testSliceColumns = do
8383 log " * Slice columns"
8484 let mat = fromMaybe (M.zeros 1 1) $ M.fromArray 2 3 [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
@@ -86,7 +86,7 @@ testSliceColumns = do
8686 assert $ M.sliceCols 0 1 mat == expected
8787
8888
89−testSliceRows :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
89+testSliceRows :: Effect Unit
9090testSliceRows = do
9191 log " * Slice rows"
9292 let mat = fromMaybe (M.zeros 1 1) $ M.fromArray 3 2 [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
@@ -94,7 +94,7 @@ testSliceRows = do
9494 assert $ M.sliceRows 0 1 mat == expected
9595
9696
97−testInsertColumn :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
97+testInsertColumn :: Effect Unit
9898testInsertColumn = do
9999 log " * Insert column"
100100 let mat = fromMaybe (M.zeros 1 1) $ M.fromArray 2 2 [1.0, 2.0, 4.0, 5.0]
@@ -104,7 +104,7 @@ testInsertColumn = do
104104 assert $ M.insertCol 0 [3.0, 6.0] mat == expected2
105105
106106
107−testAdd :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
107+testAdd :: Effect Unit
108108testAdd = do
109109 log " * Multiply matrices"
110110 let m1 = fromMaybe (M.zeros 1 1) $ M.fromArray 2 3 [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
@@ -112,7 +112,7 @@ testAdd = do
112112 assert $ M.add m1 m1 == expected
113113
114114
115−testMultiply :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
115+testMultiply :: Effect Unit
116116testMultiply = do
117117 log " * Multiply matrices"
118118 let m1 = fromMaybe (M.zeros 1 1) $ M.fromArray 2 3 [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
@@ -121,7 +121,7 @@ testMultiply = do
121121 assert $ M.multiply m1 m2 == expected
122122
123123
124−testTranspose :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
124+testTranspose :: Effect Unit
125125testTranspose = do
126126 log " * Transpose matrix"
127127 let mat = fromMaybe (M.zeros 1 1) $ M.fromArray 2 3 [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
@@ -129,7 +129,7 @@ testTranspose = do
129129 assert $ M.transpose mat == expected
130130
131131
132−testIdentity :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
132+testIdentity :: Effect Unit
133133testIdentity = do
134134 log " * Identity matrix"
135135 let expected = fromMaybe (M.zeros 1 1) $ M.fromArray 3 3 [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]