diff options
Diffstat (limited to 'src/LambdaCube/Compiler/Infer.hs')
-rw-r--r-- | src/LambdaCube/Compiler/Infer.hs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/LambdaCube/Compiler/Infer.hs b/src/LambdaCube/Compiler/Infer.hs index 18062471..f727ea4b 100644 --- a/src/LambdaCube/Compiler/Infer.hs +++ b/src/LambdaCube/Compiler/Infer.hs | |||
@@ -19,7 +19,7 @@ module LambdaCube.Compiler.Infer | |||
19 | ( SName, Lit(..), Visibility(..) | 19 | ( SName, Lit(..), Visibility(..) |
20 | , Exp (..), Neutral (..), ExpType(..), GlobalEnv | 20 | , Exp (..), Neutral (..), ExpType(..), GlobalEnv |
21 | , pattern Var, pattern CaseFun, pattern TyCaseFun, pattern App_, app_, pattern TType | 21 | , pattern Var, pattern CaseFun, pattern TyCaseFun, pattern App_, app_, pattern TType |
22 | , pattern Con, pattern TyCon, pattern Pi, pattern Lam, pattern Fun, pattern Func, pattern FL, pattern UFL, unFunc_ | 22 | , pattern Con, pattern TyCon, pattern Pi, pattern Lam, pattern Fun, pattern Func, pattern Reduced, pattern UFL, unFunc_ |
23 | , outputType, boolType, trueExp | 23 | , outputType, boolType, trueExp |
24 | , down, Subst (..), free, subst, upDB | 24 | , down, Subst (..), free, subst, upDB |
25 | , initEnv, Env(..) | 25 | , initEnv, Env(..) |
@@ -198,13 +198,6 @@ parent = \case | |||
198 | 198 | ||
199 | -------------------------------------------------------------------------------- simple typing | 199 | -------------------------------------------------------------------------------- simple typing |
200 | 200 | ||
201 | litType = \case | ||
202 | LInt _ -> TInt | ||
203 | LFloat _ -> TFloat | ||
204 | LString _ -> TString | ||
205 | LChar _ -> TChar | ||
206 | |||
207 | |||
208 | neutType te = \case | 201 | neutType te = \case |
209 | App_ f x -> appTy (neutType te f) x | 202 | App_ f x -> appTy (neutType te f) x |
210 | Var_ i -> snd $ varType "C" i te | 203 | Var_ i -> snd $ varType "C" i te |
@@ -393,7 +386,7 @@ inferN_ tellTrace = infer where | |||
393 | ELet1 le te b{-in-} -> infer (ELet2 le (replaceMetas' eet{-let-}) te) b{-in-} | 386 | ELet1 le te b{-in-} -> infer (ELet2 le (replaceMetas' eet{-let-}) te) b{-in-} |
394 | EBind2_ si BMeta tt_ te | 387 | EBind2_ si BMeta tt_ te |
395 | | ERHS te' <- te -> refocus (ERHS $ EBind2_ si BMeta tt_ te') eet | 388 | | ERHS te' <- te -> refocus (ERHS $ EBind2_ si BMeta tt_ te') eet |
396 | | Unit <- tt -> refocus te $ subst 0 TT eet | 389 | | (hnf -> Unit) <- tt -> refocus te $ subst 0 TT eet |
397 | | Empty msg <- tt -> throwError' $ ETypeError (text msg) si | 390 | | Empty msg <- tt -> throwError' $ ETypeError (text msg) si |
398 | | T2 x y <- tt, let te' = EBind2_ si BMeta (up 1 y) $ EBind2_ si BMeta x te | 391 | | T2 x y <- tt, let te' = EBind2_ si BMeta (up 1 y) $ EBind2_ si BMeta x te |
399 | -> refocus te' $ subst 2 (t2C (Var 1) (Var 0)) $ up 2 eet | 392 | -> refocus te' $ subst 2 (t2C (Var 1) (Var 0)) $ up 2 eet |
@@ -578,7 +571,7 @@ dependentVars ie = cycle mempty | |||
578 | grow = flip foldMap ie $ \case | 571 | grow = flip foldMap ie $ \case |
579 | (n, t) -> (Set.singleton n <-> freeVars t) <> case t of | 572 | (n, t) -> (Set.singleton n <-> freeVars t) <> case t of |
580 | CstrT _{-todo-} ty f -> freeVars ty <-> freeVars f | 573 | CstrT _{-todo-} ty f -> freeVars ty <-> freeVars f |
581 | CSplit a b c -> freeVars a <-> (freeVars b <> freeVars c) | 574 | (hnf -> CSplit a b c) -> freeVars a <-> (freeVars b <> freeVars c) |
582 | _ -> mempty | 575 | _ -> mempty |
583 | where | 576 | where |
584 | a --> b = \s -> if Set.null $ a `Set.intersection` s then mempty else b | 577 | a --> b = \s -> if Set.null $ a `Set.intersection` s then mempty else b |
@@ -740,7 +733,7 @@ mkELet n x xt = {-(if null vs then id else trace_ $ "mkELet " ++ show (length vs | |||
740 | getFix x _ = x | 733 | getFix x _ = x |
741 | 734 | ||
742 | 735 | ||
743 | removeHiddenUnit (Pi Hidden Unit (down 0 -> Just t)) = removeHiddenUnit t | 736 | removeHiddenUnit (Pi Hidden (hnf -> Unit) (down 0 -> Just t)) = removeHiddenUnit t |
744 | removeHiddenUnit (Pi h a b) = Pi h a $ removeHiddenUnit b | 737 | removeHiddenUnit (Pi h a b) = Pi h a $ removeHiddenUnit b |
745 | removeHiddenUnit t = t | 738 | removeHiddenUnit t = t |
746 | 739 | ||