on master help sign in
Inline assert_smaller correctly
9e350acEdwin Brady
CHANGELOG+4
@@ -18,6 +18,10 @@ New in 0.9.11:
18 when disambiguating overloaded names. For example, it is possible to
18 when disambiguating overloaded names. For example, it is possible to
19 write "with Vect [1,2,3]" at the REPL instead of "the (Vect _ _) [1,2,3]",
19 write "with Vect [1,2,3]" at the REPL instead of "the (Vect _ _) [1,2,3]",
20 because the Vect constructors are defined in a namespace called Vect.
20 because the Vect constructors are defined in a namespace called Vect.
21+* assert_smaller internal function, which marks an expression as smaller than
22+ a pattern for use in totality checking.
23+ e.g. "assert_smaller (x :: xs) (f xs)" asserts that "f xs" will always be
24+ structurally smaller than "(x :: xs)"
21
25
22Internal changes
26Internal changes
23
27
src/IRTS/Compiler.hs+1−1
@@ -182,7 +182,7 @@ instance ToIR (TT Name) where
182 l == txt "lazy"
182 l == txt "lazy"
183 = do arg' <- ir' env arg
183 = do arg' <- ir' env arg
184 return $ LLazyExp arg'
184 return $ LLazyExp arg'
185− | (P _ (UN a) _, [_, _, _, arg]) <- unApply tm,
185+ | (P _ (UN a) _, [_, _, arg]) <- unApply tm,
186 a == txt "assert_smaller"
186 a == txt "assert_smaller"
187 = ir' env arg
187 = ir' env arg
188 | (P _ (UN p) _, [_, arg]) <- unApply tm,
188 | (P _ (UN p) _, [_, arg]) <- unApply tm,