@@ -14,6 +14,7 @@ main = do
1414 testIntDivMod
1515 testIntDegree
1616 testRecordInstances
17+ testArrayInstances
1718 testGenericRep
1819
1920foreign import testNumberShow :: (Number -> String ) -> AlmostEff
@@ -151,3 +152,17 @@ testRecordInstances = do
151152 assert " Record top" $
152153 (top :: { a :: Boolean } ).a
153154 == top
155+
156+ testArrayInstances :: AlmostEff
157+ testArrayInstances = do
158+ assert " Functor" $ map (_ + 1 ) [1 , 2 , 3 ] == [2 , 3 , 4 ]
159+ assert " Functor empty" $ map (_ + 1 ) [] == []
160+ assert " Semigroup" $ append [1 , 2 ] [3 , 4 ] == [1 , 2 , 3 , 4 ]
161+ assert " Semigroup empty left" $ append [] [3 , 4 ] == [3 , 4 ]
162+ assert " Semigroup emtpy right" $ append [1 , 2 ] [] == [1 , 2 ]
163+ assert " Apply" $ apply [(_ + 1 ), (_ * 2 )] [1 , 2 , 3 ] == [2 , 3 , 4 , 2 , 4 , 6 ]
164+ assert " Apply empty left" $ apply ([] :: Array (Int -> Int )) [1 , 2 , 3 ] == []
165+ assert " Apply empty right" $ apply [(_ + 1 ), (_ * 2 )] [] == []
166+ assert " Bind instance" $ bind [1 , 2 , 3 ] (\a -> [a, a]) == [1 , 1 , 2 , 2 , 3 , 3 ]
167+ assert " Bind instance empty left" $ bind ([] :: Array Int ) (\a -> [a, a]) == []
168+ assert " Bind instance empty right" $ bind [1 , 2 , 3 ] (\_ -> ([] :: Array Int )) == []
0 commit comments