diff options
Diffstat (limited to 'testdata/complex.lc')
-rw-r--r-- | testdata/complex.lc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/testdata/complex.lc b/testdata/complex.lc index 9c908b52..1a7d8b00 100644 --- a/testdata/complex.lc +++ b/testdata/complex.lc | |||
@@ -16,8 +16,8 @@ polar a b = Complex a b | |||
16 | 16 | ||
17 | -- TODO: Write tests that checks if the derived type is the same as the given | 17 | -- TODO: Write tests that checks if the derived type is the same as the given |
18 | cabs :: forall r . Complex r -> Float | 18 | cabs :: forall r . Complex r -> Float |
19 | cabs @Normal (Complex a b) = sqrt (a*a + b*b) | 19 | cabs @'Normal (Complex a b) = sqrt (a*a + b*b) |
20 | cabs @Polar (Complex r _phi) = r | 20 | cabs @'Polar (Complex r _phi) = r |
21 | 21 | ||
22 | toPolar :: Complex Normal -> Complex Polar | 22 | toPolar :: Complex Normal -> Complex Polar |
23 | toPolar (Complex x y) = | 23 | toPolar (Complex x y) = |
@@ -66,10 +66,10 @@ toNormal (Complex r phi) = Complex (r * cos phi) (r * sin phi) | |||
66 | 66 | ||
67 | {- | 67 | {- |
68 | convert :: forall r0 . forall r1 . Complex r0 -> Complex r1 | 68 | convert :: forall r0 . forall r1 . Complex r0 -> Complex r1 |
69 | convert @Normal @Normal c = c | 69 | convert @'Normal @'Normal c = c |
70 | convert @Polar @Polar c = c | 70 | convert @'Polar @'Polar c = c |
71 | convert @Normal @Polar c = toPolar c | 71 | convert @'Normal @'Polar c = toPolar c |
72 | convert @Polar @Normal c = toNormal c | 72 | convert @'Polar @'Normal c = toNormal c |
73 | !Failed mandel | 73 | !Failed mandel |
74 | checkMetas lam: \(a : V0~Polar) (b : Normal~V1) (c : 'Num ('MatVecElem 'Float)) (d : 'Num ('MatVecElem | 74 | checkMetas lam: \(a : V0~Polar) (b : Normal~V1) (c : 'Num ('MatVecElem 'Float)) (d : 'Num ('MatVecElem |
75 | 'Float)) (e : Polar~V4) (f : Normal~V5) (g : V6~Normal) {h:'Repr} (i : h~V8) (j : 'Complex V9) -> | 75 | 'Float)) (e : Polar~V4) (f : Normal~V5) (g : V6~Normal) {h:'Repr} (i : h~V8) (j : 'Complex V9) -> |
@@ -79,10 +79,10 @@ convert @Polar @Normal c = toNormal c | |||
79 | 79 | ||
80 | {- | 80 | {- |
81 | convert :: forall r0 . forall r1 . Complex r0 -> Complex r1 | 81 | convert :: forall r0 . forall r1 . Complex r0 -> Complex r1 |
82 | convert @Normal @Normal = id | 82 | convert @'Normal @'Normal = id |
83 | convert @Polar @Polar = id | 83 | convert @'Polar @'Polar = id |
84 | convert @Normal @Polar = toPolar | 84 | convert @'Normal @'Polar = toPolar |
85 | convert @Polar @Normal = toNormal | 85 | convert @'Polar @'Normal = toNormal |
86 | !Failed mandel | 86 | !Failed mandel |
87 | type error: can not unify | 87 | type error: can not unify |
88 | Polar | 88 | Polar |
@@ -90,7 +90,7 @@ convert @Polar @Normal = toNormal | |||
90 | Normal | 90 | Normal |
91 | 91 | ||
92 | in "./testdata/accept/mandel.lc" (line 51, column 27): | 92 | in "./testdata/accept/mandel.lc" (line 51, column 27): |
93 | convert @Normal @Polar = toPolar | 93 | convert @'Normal @'Polar = toPolar |
94 | ^^^^^^^ | 94 | ^^^^^^^ |
95 | -} | 95 | -} |
96 | 96 | ||
@@ -111,10 +111,10 @@ r should have type X, but it has Y | |||
111 | it_should_fail (Complex r _ _ _ _) = r | 111 | it_should_fail (Complex r _ _ _ _) = r |
112 | 112 | ||
113 | add :: forall r0 . forall r1 . Complex r0 -> Complex r1 -> Complex r0 | 113 | add :: forall r0 . forall r1 . Complex r0 -> Complex r1 -> Complex r0 |
114 | add @Normal @Normal (Complex a b) (Complex c d) = Complex (a + c) (b + d) | 114 | add @'Normal @'Normal (Complex a b) (Complex c d) = Complex (a + c) (b + d) |
115 | 115 | ||
116 | {- | 116 | {- |
117 | add @Polar @Polar c0 c1 = toPolar (add (toNormal c0) (toNormal c1)) | 117 | add @'Polar @'Polar c0 c1 = toPolar (add (toNormal c0) (toNormal c1)) |
118 | !Failed mandel | 118 | !Failed mandel |
119 | checkMetas lam: \(a : Polar~V0) (b : 'Num ('MatVecElem 'Float)) (c : 'Num ('MatVecElem 'Float)) | 119 | checkMetas lam: \(a : Polar~V0) (b : 'Num ('MatVecElem 'Float)) (c : 'Num ('MatVecElem 'Float)) |
120 | {d:'Repr} (e : Polar~d) (f : V5~Polar) (g : 'Complex V6) (h : 'Complex d) -> 'ReprCase (\'Repr -> | 120 | {d:'Repr} (e : Polar~d) (f : V5~Polar) (g : 'Complex V6) (h : 'Complex d) -> 'ReprCase (\'Repr -> |
@@ -126,7 +126,7 @@ add @Polar @Polar c0 c1 = toPolar (add (toNormal c0) (toNormal c1)) | |||
126 | -} | 126 | -} |
127 | 127 | ||
128 | mul :: forall r0 r1 . Complex r0 -> Complex r1 -> Complex r0 | 128 | mul :: forall r0 r1 . Complex r0 -> Complex r1 -> Complex r0 |
129 | mul @Normal @Normal (Complex a b) (Complex c d) = Complex (a*c - b*d) (b*c + a*d) | 129 | mul @'Normal @'Normal (Complex a b) (Complex c d) = Complex (a*c - b*d) (b*c + a*d) |
130 | 130 | ||
131 | {- TODO: The hidden parameters should not be shown... or a configuration level... | 131 | {- TODO: The hidden parameters should not be shown... or a configuration level... |
132 | {a : 'Num ('MatVecElem 'Float)} -> {b : 'Num ('MatVecElem 'Float)} -> {c : 'Num ('MatVecElem 'Float)} -> | 132 | {a : 'Num ('MatVecElem 'Float)} -> {b : 'Num ('MatVecElem 'Float)} -> {c : 'Num ('MatVecElem 'Float)} -> |