You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
property["String obeys the Applicative identity law"]=forAll{(x :String)in
53
+
return(pure(identity)<*> x)== x
54
+
}
55
+
56
+
reportProperty["String obeys the first Applicative composition law"]=forAll{(fl :ArrayOf<ArrowOf<Character,Character>>, gl :ArrayOf<ArrowOf<Character,Character>>, x :String)in
57
+
letf= fl.getArray.map({ $0.getArrow })
58
+
letg= gl.getArray.map({ $0.getArrow })
59
+
return(curry(•)<^> f <*> g <*> x)==(f <*>(g <*> x))
60
+
}
61
+
62
+
reportProperty["String obeys the second Applicative composition law"]=forAll{(fl :ArrayOf<ArrowOf<Character,Character>>, gl :ArrayOf<ArrowOf<Character,Character>>, x :String)in
63
+
letf= fl.getArray.map({ $0.getArrow })
64
+
letg= gl.getArray.map({ $0.getArrow })
65
+
return(pure(curry(•))<*> f <*> g <*> x)==(f <*>(g <*> x))
66
+
}
67
+
68
+
property["String obeys the Monoidal left identity law"]=forAll{(x :String)in
69
+
return(x + String.mzero)== x
70
+
}
71
+
72
+
property["String obeys the Monoidal right identity law"]=forAll{(x :String)in
73
+
return(String.mzero + x)== x
74
+
}
75
+
76
+
property["cons behaves"]=forAll{(c :Character, s :String)in
77
+
returnString.cons(c, tail: s)==String(c)+ s
78
+
}
79
+
80
+
property["replicate behaves"]=forAll{(n :UInt, x :Character)in
0 commit comments