summaryrefslogtreecommitdiff
path: root/testdata/complex.lc
diff options
context:
space:
mode:
Diffstat (limited to 'testdata/complex.lc')
-rw-r--r--testdata/complex.lc28
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
18cabs :: forall r . Complex r -> Float 18cabs :: forall r . Complex r -> Float
19cabs @Normal (Complex a b) = sqrt (a*a + b*b) 19cabs @'Normal (Complex a b) = sqrt (a*a + b*b)
20cabs @Polar (Complex r _phi) = r 20cabs @'Polar (Complex r _phi) = r
21 21
22toPolar :: Complex Normal -> Complex Polar 22toPolar :: Complex Normal -> Complex Polar
23toPolar (Complex x y) = 23toPolar (Complex x y) =
@@ -66,10 +66,10 @@ toNormal (Complex r phi) = Complex (r * cos phi) (r * sin phi)
66 66
67{- 67{-
68convert :: forall r0 . forall r1 . Complex r0 -> Complex r1 68convert :: forall r0 . forall r1 . Complex r0 -> Complex r1
69convert @Normal @Normal c = c 69convert @'Normal @'Normal c = c
70convert @Polar @Polar c = c 70convert @'Polar @'Polar c = c
71convert @Normal @Polar c = toPolar c 71convert @'Normal @'Polar c = toPolar c
72convert @Polar @Normal c = toNormal c 72convert @'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{-
81convert :: forall r0 . forall r1 . Complex r0 -> Complex r1 81convert :: forall r0 . forall r1 . Complex r0 -> Complex r1
82convert @Normal @Normal = id 82convert @'Normal @'Normal = id
83convert @Polar @Polar = id 83convert @'Polar @'Polar = id
84convert @Normal @Polar = toPolar 84convert @'Normal @'Polar = toPolar
85convert @Polar @Normal = toNormal 85convert @'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
111it_should_fail (Complex r _ _ _ _) = r 111it_should_fail (Complex r _ _ _ _) = r
112 112
113add :: forall r0 . forall r1 . Complex r0 -> Complex r1 -> Complex r0 113add :: forall r0 . forall r1 . Complex r0 -> Complex r1 -> Complex r0
114add @Normal @Normal (Complex a b) (Complex c d) = Complex (a + c) (b + d) 114add @'Normal @'Normal (Complex a b) (Complex c d) = Complex (a + c) (b + d)
115 115
116{- 116{-
117add @Polar @Polar c0 c1 = toPolar (add (toNormal c0) (toNormal c1)) 117add @'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
128mul :: forall r0 r1 . Complex r0 -> Complex r1 -> Complex r0 128mul :: forall r0 r1 . Complex r0 -> Complex r1 -> Complex r0
129mul @Normal @Normal (Complex a b) (Complex c d) = Complex (a*c - b*d) (b*c + a*d) 129mul @'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)} ->