@@ -29,6 +29,10 @@ expandDo dsl (PLet n ty v tm)
29 = let sc = PApp (fileFC "(dsl)") letb [pexp v, pexp (var dsl n tm 0)] in
29 = let sc = PApp (fileFC "(dsl)") letb [pexp v, pexp (var dsl n tm 0)] in
30 expandDo dsl sc
30 expandDo dsl sc
31expandDo dsl (PLet n ty v tm) = PLet n (expandDo dsl ty) (expandDo dsl v) (expandDo dsl tm)
31expandDo dsl (PLet n ty v tm) = PLet n (expandDo dsl ty) (expandDo dsl v) (expandDo dsl tm)
32+expandDo dsl (PPi p n ty tm)
33+ | Just pi <- dsl_pi dsl
34+ = let sc = PApp (fileFC "(dsl)") pi [pexp ty, pexp (var dsl n tm 0)] in
32expandDo dsl (PPi p n ty tm) = PPi p n (expandDo dsl ty) (expandDo dsl tm)
36expandDo dsl (PPi p n ty tm) = PPi p n (expandDo dsl ty) (expandDo dsl tm)
33expandDo dsl (PApp fc t args) = PApp fc (expandDo dsl t)
37expandDo dsl (PApp fc t args) = PApp fc (expandDo dsl t)
34 (map (fmap (expandDo dsl)) args)
38 (map (fmap (expandDo dsl)) args)
@@ -88,7 +92,10 @@ var dsl n t i = v' i t where
88 | Nothing <- dsl_let dsl
92 | Nothing <- dsl_let dsl
89 = PLet n (v' i ty) (v' i val) (v' i sc)
93 = PLet n (v' i ty) (v' i val) (v' i sc)
90 | otherwise = PLet n (v' i ty) (v' i val) (v' (i + 1) sc)
94 | otherwise = PLet n (v' i ty) (v' i val) (v' (i + 1) sc)
96+ | Nothing <- dsl_pi dsl
91− v' i (PPi p n ty sc) = PPi p n (v' i ty) (v' i sc)
97+ = PPi p n (v' i ty) (v' i sc)
98+ | otherwise = PPi p n (v' i ty) (v' (i+1) sc)
92 v' i (PTyped l r) = PTyped (v' i l) (v' i r)
99 v' i (PTyped l r) = PTyped (v' i l) (v' i r)
93 v' i (PApp f x as) = PApp f (v' i x) (fmap (fmap (v' i)) as)
100 v' i (PApp f x as) = PApp f (v' i x) (fmap (fmap (v' i)) as)
94 v' i (PCase f t as) = PCase f (v' i t) (fmap (pmap (v' i)) as)
101 v' i (PCase f t as) = PCase f (v' i t) (fmap (pmap (v' i)) as)