diff options
author | Péter Diviánszky <divipp@gmail.com> | 2016-05-14 02:32:20 +0200 |
---|---|---|
committer | Péter Diviánszky <divipp@gmail.com> | 2016-05-14 02:32:20 +0200 |
commit | 7a8eabd1a066579d4dcb35f5950f87bad5667b37 (patch) | |
tree | d97d7af1c50458fabb41a612731d563accb4b3d9 /src | |
parent | c1079ecb25633a9c47d61bed034b50551cadd326 (diff) |
revert change
Diffstat (limited to 'src')
-rw-r--r-- | src/LambdaCube/Compiler/Core.hs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/LambdaCube/Compiler/Core.hs b/src/LambdaCube/Compiler/Core.hs index 5c13e54a..e86e205a 100644 --- a/src/LambdaCube/Compiler/Core.hs +++ b/src/LambdaCube/Compiler/Core.hs | |||
@@ -328,19 +328,21 @@ instance Subst Exp Exp where | |||
328 | where | 328 | where |
329 | f i (Neut n) = substNeut n | 329 | f i (Neut n) = substNeut n |
330 | where | 330 | where |
331 | substNeut e | dbGE i e = Neut e | ||
331 | substNeut e = case e of | 332 | substNeut e = case e of |
332 | Var_ k -> case compare k i of GT -> Var $ k - 1; LT -> Var k; EQ -> up (i - i0) x | 333 | Var_ k -> case compare k i of GT -> Var $ k - 1; LT -> Var k; EQ -> up (i - i0) x |
333 | CaseFun__ fs s as n -> if dbGE_ i fs then Neut e else evalCaseFun (adjustDB i fs) s (f i <$> as) (substNeut n) | 334 | CaseFun__ fs s as n -> evalCaseFun (adjustDB i fs) s (f i <$> as) (substNeut n) |
334 | TyCaseFun__ fs s as n -> if dbGE_ i fs then Neut e else evalTyCaseFun_ (adjustDB i fs) s (f i <$> as) (substNeut n) | 335 | TyCaseFun__ fs s as n -> evalTyCaseFun_ (adjustDB i fs) s (f i <$> as) (substNeut n) |
335 | App__ fs a b -> if dbGE_ i fs then Neut e else app__ (adjustDB i fs) (substNeut a) (f i b) | 336 | App__ fs a b -> app__ (adjustDB i fs) (substNeut a) (f i b) |
336 | Fun_ md fn xs v -> if dbGE_ i md then Neut e else mkFun_ (adjustDB i md) fn (f i <$> xs) $ f i v | 337 | Fun_ md fn xs v -> mkFun_ (adjustDB i md) fn (f i <$> xs) $ f i v |
338 | f i e | dbGE i e = e | ||
337 | f i e = case e of | 339 | f i e = case e of |
338 | Lam_ md b -> if dbGE_ i md then e else Lam_ (adjustDB i md) (f (i+1) b) | 340 | Lam_ md b -> Lam_ (adjustDB i md) (f (i+1) b) |
339 | Con_ md s n as -> if dbGE_ i md then e else Con_ (adjustDB i md) s n $ f i <$> as | 341 | Con_ md s n as -> Con_ (adjustDB i md) s n $ f i <$> as |
340 | Pi_ md h a b -> if dbGE_ i md then e else Pi_ (adjustDB i md) h (f i a) (f (i+1) b) | 342 | Pi_ md h a b -> Pi_ (adjustDB i md) h (f i a) (f (i+1) b) |
341 | TyCon_ md s as -> if dbGE_ i md then e else TyCon_ (adjustDB i md) s $ f i <$> as | 343 | TyCon_ md s as -> TyCon_ (adjustDB i md) s $ f i <$> as |
342 | Let_ md a b -> if dbGE_ i md then e else Let_ (adjustDB i md) (subst_ i dx x a) (f (i+1) b) | 344 | Let_ md a b -> Let_ (adjustDB i md) (subst_ i dx x a) (f (i+1) b) |
343 | RHS a -> if dbGE i a then e else RHS $ hnf $ f i a | 345 | RHS a -> RHS $ hnf $ f i a |
344 | x -> x | 346 | x -> x |
345 | 347 | ||
346 | adjustDB i md = if usedVar i md then delVar i md <> shiftFreeVars (i-i0) dx else delVar i md | 348 | adjustDB i md = if usedVar i md then delVar i md <> shiftFreeVars (i-i0) dx else delVar i md |