File tree 2 files changed +34
-5
lines changed
src/Juvix/Compiler/Internal/Translation/FromInternal/Analysis/TypeChecking/Traits
tests/Compilation/positive
2 files changed +34
-5
lines changed Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ lookupInstance' visited ctab tab name params
248
248
return True
249
249
(InstanceParamApp app1, InstanceParamApp app2)
250
250
| app1 ^. instanceAppHead == app2 ^. instanceAppHead -> do
251
- and <$> sequence (zipWithExact (goMatch assignMetas) (app1 ^. instanceAppArgs) (app2 ^. instanceAppArgs))
251
+ andM (zipWithExact (goMatch assignMetas) (app1 ^. instanceAppArgs) (app2 ^. instanceAppArgs))
252
252
(InstanceParamFun fun1, InstanceParamFun fun2) -> do
253
253
l <- goMatch assignMetas (fun1 ^. instanceFunLeft) (fun2 ^. instanceFunLeft)
254
254
r <- goMatch assignMetas (fun1 ^. instanceFunRight) (fun2 ^. instanceFunRight)
Original file line number Diff line number Diff line change @@ -2,7 +2,12 @@ module test092;
2
2
3
3
import Stdlib.Prelude as Prelude open;
4
4
5
- two : Nat := suc (suc zero);
5
+ n1 : Nat := suc zero;
6
+ n2 : Nat := suc n1;
7
+ n3 : Nat := suc n2;
8
+ n4 : Nat := suc n3;
9
+ n5 : Nat := suc n4;
10
+ n6 : Nat := suc n5;
6
11
7
12
type uint (bytes : Nat) := mk Nat
8
13
with
14
19
};
15
20
end;
16
21
22
+ module Le;
23
+ syntax operator '<= comparison;
24
+
25
+ trait
26
+ type '<= (a b : Nat) := truth
27
+ with
28
+ instance
29
+ le-zero {a : Nat} : zero '<= a := truth;
30
+
31
+ instance
32
+ le-suc {a b : Nat} {{a '<= b}} : suc a '<= suc b := truth;
33
+ end;
34
+
35
+ test (a b : Nat) {{a '<= b}} : Unit := unit;
36
+
37
+ example1 : Unit := test n1 n4;
38
+ example2 : Unit := test n4 n4;
39
+ example3 : Unit := test 1 3;
40
+ end;
41
+
17
42
main : _ :=
18
43
let
19
- e : uint two := uint.mk 5;
44
+ z : uint zero := uint.mk 5;
45
+ e : uint n2 := uint.mk 5;
20
46
e3 : uint (suc (suc (suc zero))) := uint.mk 5;
21
47
e4 : uint 7 := uint.mk 87;
22
- in printStringLn (Show.show e) >>>
23
- printStringLn (Show.show e3) >>> printStringLn (Show.show e4);
48
+ in printStringLn (Show.show z)
49
+ >>> printStringLn (Show.show e)
50
+ >>> printStringLn (Show.show e3)
51
+ >>> printStringLn (Show.show e3)
52
+ >>> printStringLn (Show.show e4);
You can’t perform that action at this time.
0 commit comments