summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPéter Diviánszky <divipp@gmail.com>2016-02-01 09:25:10 +0100
committerPéter Diviánszky <divipp@gmail.com>2016-02-01 09:25:10 +0100
commit6a246f8c2553e76d70c2374ff68522c0357a7a9b (patch)
tree7731a93887dd86f957487a8551845fe0f2fe4ff1
parent91df95d9ac2f07d418a7973ad5ecb4bdb8c2468d (diff)
erease CaseFun's type parameters
-rw-r--r--src/LambdaCube/Compiler/CoreToIR.hs5
-rw-r--r--src/LambdaCube/Compiler/Infer.hs70
-rw-r--r--testdata/Prelude.out20
-rw-r--r--testdata/language-features/adt/adt05.out2
4 files changed, 58 insertions, 39 deletions
diff --git a/src/LambdaCube/Compiler/CoreToIR.hs b/src/LambdaCube/Compiler/CoreToIR.hs
index a378815d..4ddf4323 100644
--- a/src/LambdaCube/Compiler/CoreToIR.hs
+++ b/src/LambdaCube/Compiler/CoreToIR.hs
@@ -873,13 +873,13 @@ toExp = flip runReader [] . flip evalStateT freshTypeVars . f_
873 I.Con s n xs -> Con (show s) <$> f_ (I.nType s, I.TType) <*> chain [] (I.nType s) (I.mkConPars n et ++ xs) 873 I.Con s n xs -> Con (show s) <$> f_ (I.nType s, I.TType) <*> chain [] (I.nType s) (I.mkConPars n et ++ xs)
874 I.TyCon s xs -> Con (show s) <$> f_ (I.nType s, I.TType) <*> chain [] (I.nType s) xs 874 I.TyCon s xs -> Con (show s) <$> f_ (I.nType s, I.TType) <*> chain [] (I.nType s) xs
875 I.Fun s xs -> Fun (show s) <$> f_ (I.nType s, I.TType) <*> chain [] (I.nType s) xs 875 I.Fun s xs -> Fun (show s) <$> f_ (I.nType s, I.TType) <*> chain [] (I.nType s) xs
876 I.CaseFun s xs n -> Fun (show s) <$> f_ (I.nType s, I.TType) <*> chain [] (I.nType s) (xs ++ [I.Neut n]) 876 I.CaseFun s xs n -> asks makeTE >>= \te -> Fun (show s) <$> f_ (I.nType s, I.TType) <*> chain [] (I.nType s) (I.makeCaseFunPars te n ++ xs ++ [I.Neut n])
877 I.Neut (I.App_ a b) -> asks makeTE >>= \te -> do 877 I.Neut (I.App_ a b) -> asks makeTE >>= \te -> do
878 let t = I.neutType te a 878 let t = I.neutType te a
879 app' <$> f_ (I.Neut a, t) <*> (head <$> chain [] t [b]) 879 app' <$> f_ (I.Neut a, t) <*> (head <$> chain [] t [b])
880 I.ELit l -> pure $ ELit l 880 I.ELit l -> pure $ ELit l
881 I.TType -> pure TType 881 I.TType -> pure TType
882 I.PMLabel x _ -> f_ (x, et) 882 x@I.PMLabel{} -> f_ (I.unpmlabel x, et)
883 I.FixLabel _ x -> f_ (x, et) 883 I.FixLabel _ x -> f_ (x, et)
884-- I.LabelEnd x -> f x -- not possible 884-- I.LabelEnd x -> f x -- not possible
885 z -> error $ "toExp: " ++ show z 885 z -> error $ "toExp: " ++ show z
@@ -937,6 +937,7 @@ substE n x = \case
937 Fun n' cn xs -> Fun n' cn (map (substE n x) xs) 937 Fun n' cn xs -> Fun n' cn (map (substE n x) xs)
938 TType -> TType 938 TType -> TType
939 EApp a b -> app' (substE n x a) (substE n x b) 939 EApp a b -> app' (substE n x a) (substE n x b)
940 x@ELit{} -> x
940 z -> error $ "substE: " ++ ppShow z 941 z -> error $ "substE: " ++ ppShow z
941 942
942app' (Lam _ (PVar _ n) _ x) b = substE n b x 943app' (Lam _ (PVar _ n) _ x) b = substE n b x
diff --git a/src/LambdaCube/Compiler/Infer.hs b/src/LambdaCube/Compiler/Infer.hs
index bc599fda..56d96726 100644
--- a/src/LambdaCube/Compiler/Infer.hs
+++ b/src/LambdaCube/Compiler/Infer.hs
@@ -26,7 +26,7 @@ module LambdaCube.Compiler.Infer
26 , Infos(..), listInfos, ErrorMsg(..), PolyEnv(..), ErrorT, throwErrorTCM, parseLC, joinPolyEnvs, filterPolyEnv, inference_ 26 , Infos(..), listInfos, ErrorMsg(..), PolyEnv(..), ErrorT, throwErrorTCM, parseLC, joinPolyEnvs, filterPolyEnv, inference_
27 , ImportItems (..) 27 , ImportItems (..)
28 , SI(..), Range(..) 28 , SI(..), Range(..)
29 , nType, neutType, appTy, mkConPars 29 , nType, neutType, appTy, mkConPars, makeCaseFunPars, unpmlabel
30 , MaxDB(..) 30 , MaxDB(..)
31 ) where 31 ) where
32import Data.Monoid 32import Data.Monoid
@@ -66,7 +66,7 @@ data Neutral
66 | TyCaseFun__ MaxDB TyCaseFunName [Exp] -- todo: neutral at the end 66 | TyCaseFun__ MaxDB TyCaseFunName [Exp] -- todo: neutral at the end
67 | App__ MaxDB Neutral Exp 67 | App__ MaxDB Neutral Exp
68 | Var_ !Int -- De Bruijn variable 68 | Var_ !Int -- De Bruijn variable
69 | PMLabel_ Exp{-folded expression-} Exp{-unfolded expression-} 69 | PMLabel_ FunName !Int [Exp] Exp{-unfolded expression-}
70 deriving (Show) 70 deriving (Show)
71 71
72data ConName = ConName SName MFixity Int{-ordinal number, e.g. Zero:0, Succ:1-} TyConName Type 72data ConName = ConName SName MFixity Int{-ordinal number, e.g. Zero:0, Succ:1-} TyConName Type
@@ -115,6 +115,9 @@ conName a b c d = ConName a b c (get $ snd $ getParams d) d
115 where 115 where
116 get (TyCon s _) = s 116 get (TyCon s _) = s
117 117
118makeCaseFunPars te n = case neutType te n of
119 TyCon (TyConName _ _ _ _ _ (CaseFunName _ _ pars)) xs -> take pars xs
120
118pattern Closed :: () => Up a => a -> a 121pattern Closed :: () => Up a => a -> a
119pattern Closed a <- a where Closed a = closedExp a 122pattern Closed a <- a where Closed a = closedExp a
120 123
@@ -230,7 +233,7 @@ data LabelKind
230 | -}LabelFix -- fix unfold label 233 | -}LabelFix -- fix unfold label
231 deriving (Show) 234 deriving (Show)
232 235
233pattern PMLabel x y = Neut (PMLabel_ x y) 236pattern PMLabel f i x y = Neut (PMLabel_ f i x y)
234pattern FixLabel x y = Label LabelFix x y 237pattern FixLabel x y = Label LabelFix x y
235 238
236data LEKind 239data LEKind
@@ -242,16 +245,24 @@ pattern LabelEnd x = LabelEnd_ LEPM x
242--pattern ClosedExp x = LabelEnd_ LEClosed x 245--pattern ClosedExp x = LabelEnd_ LEClosed x
243 246
244label LabelFix x y = FixLabel x y 247label LabelFix x y = FixLabel x y
245pmLabel x (UL (LabelEnd y)) = y 248pmLabel :: FunName -> Int -> [Exp] -> Exp -> Exp
246pmLabel x y = PMLabel x y 249pmLabel _ _ _ (unlabel -> LabelEnd y) = y
250pmLabel f i xs y = PMLabel f i xs y
247 251
248pattern UL a <- (unlabel -> a) where UL = unlabel 252pattern UL a <- (unlabel -> a) where UL = unlabel
249 253
250unlabel (PMLabel a _) = unlabel a 254unpmlabel (PMLabel f i a _)
255 | i >= 0 = iterateN i Lam $ Fun f $ a ++ downTo 0 i
256 | otherwise = foldl app_ (Fun f $ reverse $ drop (-i) $ reverse a) (reverse $ take (-i) $ reverse a)
257
258unlabel x@PMLabel{} = unlabel (unpmlabel x)
251unlabel (FixLabel _ a) = unlabel a 259unlabel (FixLabel _ a) = unlabel a
252--unlabel (LabelEnd_ _ a) = unlabel a 260--unlabel (LabelEnd_ _ a) = unlabel a
253unlabel a = a 261unlabel a = a
254 262
263unlabel'' (FixLabel _ a) = unlabel'' a
264unlabel'' a = a
265
255pattern UL' a <- (unlabel' -> a) where UL' = unlabel' 266pattern UL' a <- (unlabel' -> a) where UL' = unlabel'
256 267
257--unlabel (PMLabel a _) = unlabel a 268--unlabel (PMLabel a _) = unlabel a
@@ -285,7 +296,7 @@ instance Eq Exp where
285 _ == _ = False 296 _ == _ = False
286 297
287instance Eq Neutral where 298instance Eq Neutral where
288 PMLabel_ a _ == PMLabel_ a' _ = a == a' 299 PMLabel_ f i a _ == PMLabel_ f' i' a' _ = (f, i, a) == (f', i', a')
289 Fun_ a b == Fun_ a' b' = (a, b) == (a', b') 300 Fun_ a b == Fun_ a' b' = (a, b) == (a', b')
290 CaseFun_ a b c == CaseFun_ a' b' c' = (a, b, c) == (a', b', c') 301 CaseFun_ a b c == CaseFun_ a' b' c' = (a, b, c) == (a', b', c')
291 TyCaseFun_ a b == TyCaseFun_ a' b' = (a, b) == (a', b') 302 TyCaseFun_ a b == TyCaseFun_ a' b' = (a, b) == (a', b')
@@ -365,7 +376,7 @@ instance Subst Exp Exp where
365 CaseFun_ s as n -> evalCaseFun s (f i <$> as) (substNeut n) 376 CaseFun_ s as n -> evalCaseFun s (f i <$> as) (substNeut n)
366 TyCaseFun_ s as -> eval $ TyCaseFun s $ f i <$> as 377 TyCaseFun_ s as -> eval $ TyCaseFun s $ f i <$> as
367 App_ a b -> app_ (substNeut a) (f i b) 378 App_ a b -> app_ (substNeut a) (f i b)
368 PMLabel_ z v -> pmLabel (f i z) $ f i v 379 PMLabel_ fn c xs v -> pmLabel fn c (f i <$> xs) $ f i v
369 f i e | {-i >= maxDB e-} isClosed e = e 380 f i e | {-i >= maxDB e-} isClosed e = e
370 f i e = case e of 381 f i e = case e of
371 Label lk z v -> label lk (f i z) $ f i v 382 Label lk z v -> label lk (f i z) $ f i v
@@ -385,7 +396,7 @@ instance Up Neutral where
385 CaseFun__ md s as ne -> CaseFun__ (upDB n md) s (up_ n i <$> as) (up_ n i ne) 396 CaseFun__ md s as ne -> CaseFun__ (upDB n md) s (up_ n i <$> as) (up_ n i ne)
386 TyCaseFun__ md s as -> TyCaseFun__ (upDB n md) s $ map (up_ n i) as 397 TyCaseFun__ md s as -> TyCaseFun__ (upDB n md) s $ map (up_ n i) as
387 App__ md a b -> App__ (upDB n md) (up_ n i a) (up_ n i b) 398 App__ md a b -> App__ (upDB n md) (up_ n i a) (up_ n i b)
388 PMLabel_ x y -> PMLabel_ (up_ n i x) $ up_ n i y 399 PMLabel_ fn c x y -> PMLabel_ fn c (up_ n i <$> x) $ up_ n i y
389 400
390 used i e 401 used i e
391 | i >= maxDB e = False 402 | i >= maxDB e = False
@@ -397,7 +408,7 @@ instance Up Neutral where
397 CaseFun_ _ as n -> foldMap (fold f i) as <> fold f i n 408 CaseFun_ _ as n -> foldMap (fold f i) as <> fold f i n
398 TyCaseFun_ _ as -> foldMap (fold f i) as 409 TyCaseFun_ _ as -> foldMap (fold f i) as
399 App_ a b -> fold f i a <> fold f i b 410 App_ a b -> fold f i a <> fold f i b
400 PMLabel_ x _ -> fold f i x 411 PMLabel_ _ _ x _ -> foldMap (fold f i) x
401 412
402 maxDB_ = \case 413 maxDB_ = \case
403 Var_ k -> varDB k 414 Var_ k -> varDB k
@@ -405,7 +416,7 @@ instance Up Neutral where
405 CaseFun__ c _ _ _ -> c 416 CaseFun__ c _ _ _ -> c
406 TyCaseFun__ c _ _ -> c 417 TyCaseFun__ c _ _ -> c
407 App__ c a b -> c 418 App__ c a b -> c
408 PMLabel_ x y -> maxDB_ x 419 PMLabel_ _ _ x _ -> foldMap maxDB_ x
409 420
410 closedExp = \case 421 closedExp = \case
411 x@Var_{} -> error "impossible" 422 x@Var_{} -> error "impossible"
@@ -413,7 +424,7 @@ instance Up Neutral where
413 CaseFun__ _ a as n -> CaseFun__ mempty a as n 424 CaseFun__ _ a as n -> CaseFun__ mempty a as n
414 TyCaseFun__ _ a as -> TyCaseFun__ mempty a as 425 TyCaseFun__ _ a as -> TyCaseFun__ mempty a as
415 App__ _ a b -> App__ mempty a b 426 App__ _ a b -> App__ mempty a b
416 PMLabel_ x y -> PMLabel_ (closedExp x) (closedExp y) 427 PMLabel_ f i x y -> PMLabel_ f i (map closedExp x) (closedExp y)
417 428
418instance (Subst x a, Subst x b) => Subst x (a, b) where 429instance (Subst x a, Subst x b) => Subst x (a, b) where
419 subst i x (a, b) = (subst i x a, subst i x b) 430 subst i x (a, b) = (subst i x a, subst i x b)
@@ -427,13 +438,11 @@ varType err n_ env = f n_ env where
427 438
428-------------------------------------------------------------------------------- reduction 439-------------------------------------------------------------------------------- reduction
429 440
430evalCaseFun (CaseFunName _ t pars) (drop (pars + 1) -> ps) (Con (ConName _ _ i _ _) _ vs) 441evalCaseFun a ps (Con (ConName _ _ i _ _) _ vs)
431 | i /= (-1) = foldl app_ (ps !! i) vs 442 | i /= (-1) = foldl app_ (ps !! (i + 1)) vs
432 | otherwise = error "evcf" 443 | otherwise = error "evcf"
433evalCaseFun a b (Neut c) = CaseFun a b c 444evalCaseFun a b (Neut c) = CaseFun a b c
434evalCaseFun a b (FixLabel _ c) = evalCaseFun a b c 445evalCaseFun a b (FixLabel _ c) = evalCaseFun a b c
435--evalCaseFun a b (Label _ _ _) = error $ "e cf: " ++ show a -- ++ "\n" ++ show x
436--evalCaseFun a b x = error $ "ecf: " ++ show a -- ++ "\n" ++ show x
437 446
438eval = \case 447eval = \case
439 App a b -> app_ a b 448 App a b -> app_ a b
@@ -642,11 +651,13 @@ app_ (Con s n xs) a = if n < conParams s then Con s (n+1) xs else Con s n (xs ++
642app_ (TyCon s xs) a = TyCon s (xs ++ [a]) 651app_ (TyCon s xs) a = TyCon s (xs ++ [a])
643app_ (Label lk x e) a = label lk (app_ x a) $ app_ e a 652app_ (Label lk x e) a = label lk (app_ x a) $ app_ e a
644app_ (LabelEnd_ k x) a = LabelEnd_ k (app_ x a) -- ??? 653app_ (LabelEnd_ k x) a = LabelEnd_ k (app_ x a) -- ???
645app_ (PMLabel x e) a = pmLabel (app_ x a) $ app_ e a 654--app_ (PMLabel x e) a = pmLabel (neutApp x a) $ app_ e a
646app_ (Neut f) a = Neut $ App_ f a --neutApp f a 655app_ (Neut f) a = neutApp f a
647 656
648--neutApp (PMLabel_ x e) a = pmLabel (app_ x a) (app_ e a) 657neutApp (PMLabel_ f i xs e) a
649--neutApp f a = App_ f a 658 = pmLabel f (i-1) (xs ++ [a]) (app_ e a)
659-- | i == 0 = app_ (pmLabel f i xs e) a
660neutApp f a = Neut $ App_ f a
650 661
651-------------------------------------------------------------------------------- constraints env 662-------------------------------------------------------------------------------- constraints env
652 663
@@ -748,8 +759,9 @@ neutType te = \case
748 App_ f x -> appTy (neutType te f) x 759 App_ f x -> appTy (neutType te f) x
749 Var_ i -> snd $ varType "C" i te 760 Var_ i -> snd $ varType "C" i te
750 Fun_ s ts -> foldl appTy (nType s) ts 761 Fun_ s ts -> foldl appTy (nType s) ts
751 CaseFun_ s ts n -> appTy (foldl appTy (nType s) ts) (Neut n) 762 CaseFun_ s ts n -> appTy (foldl appTy (nType s) $ makeCaseFunPars te n ++ ts) (Neut n)
752 TyCaseFun_ s ts -> foldl appTy (nType s) ts 763 TyCaseFun_ s ts -> foldl appTy (nType s) ts
764 PMLabel_ s _ a _ -> foldl appTy (nType s) a
753 765
754appTy (Pi _ a b) x = subst 0 x b 766appTy (Pi _ a b) x = subst 0 x b
755appTy t x = error $ "appTy: " ++ show t 767appTy t x = error $ "appTy: " ++ show t
@@ -999,16 +1011,18 @@ recheck' msg' e (x, xt) = (recheck_ "main" (checkEnv e) (x, xt), xt)
999 (Con s n as, zt) -> checkApps [] zt (Con s n . drop (conParams s)) te (nType s) $ mkConPars n zt ++ as 1011 (Con s n as, zt) -> checkApps [] zt (Con s n . drop (conParams s)) te (nType s) $ mkConPars n zt ++ as
1000 (TyCon s as, zt) -> checkApps [] zt (TyCon s) te (nType s) as 1012 (TyCon s as, zt) -> checkApps [] zt (TyCon s) te (nType s) as
1001 (Fun s as, zt) -> checkApps [] zt (Fun s) te (nType s) as 1013 (Fun s as, zt) -> checkApps [] zt (Fun s) te (nType s) as
1002 (CaseFun s as n, zt) -> checkApps [] zt (\xs -> evalCaseFun s (init xs) (last xs)) te (nType s) (as ++ [Neut n]) 1014 (CaseFun s@(CaseFunName _ t pars) as n, zt) -> checkApps [] zt (\xs -> evalCaseFun s (init $ drop pars xs) (last xs)) te (nType s) (makeCaseFunPars te n ++ as ++ [Neut n])
1003 (TyCaseFun s as, zt) -> checkApps [] zt (TyCaseFun s) te (nType s) as 1015 (TyCaseFun s as, zt) -> checkApps [] zt (TyCaseFun s) te (nType s) as
1004 (Label lk a x, zt) -> Label lk (recheck_ msg te (a, zt)) x 1016 (Label lk a x, zt) -> Label lk (recheck_ msg te (a, zt)) x
1005 (PMLabel a x, zt) -> PMLabel (recheck_ msg te (a, zt)) x 1017 (PMLabel f i a x, zt) -> checkApps [] zt (\xs -> PMLabel f i xs x) te (nType f) a
1006 (LabelEnd_ k x, zt) -> LabelEnd_ k $ recheck_ msg te (x, zt) 1018 (LabelEnd_ k x, zt) -> LabelEnd_ k $ recheck_ msg te (x, zt)
1007 where 1019 where
1008 checkApps acc zt f _ t [] | t == zt = f $ reverse acc 1020 checkApps acc zt f _ t [] | t == zt = f $ reverse acc
1009 checkApps acc zt f te t@(Pi h x y) (b_: xs) = checkApps (b: acc) zt f te (appTy t b) xs where b = recheck_ "checkApps" te (b_, x) 1021 checkApps acc zt f te t@(Pi h x y) (b_: xs) = checkApps (b: acc) zt f te (appTy t b) xs where b = recheck_ "checkApps" te (b_, x)
1010 checkApps acc zt f te t _ = error_ $ "checkApps " ++ msg ++ "\n" ++ showEnvExp te{-todo-} (t, TType) ++ "\n\n" ++ showEnvExp e (x, xt) 1022 checkApps acc zt f te t _ = error_ $ "checkApps " ++ msg ++ "\n" ++ showEnvExp te{-todo-} (t, TType) ++ "\n\n" ++ showEnvExp e (x, xt)
1011 1023
1024 getNeut (Neut a) = a
1025
1012-- Ambiguous: (Int ~ F a) => Int 1026-- Ambiguous: (Int ~ F a) => Int
1013-- Not ambiguous: (Show a, a ~ F b) => b 1027-- Not ambiguous: (Show a, a ~ F b) => b
1014ambiguityCheck :: String -> Exp -> Maybe String 1028ambiguityCheck :: String -> Exp -> Maybe String
@@ -1170,7 +1184,7 @@ handleStmt defs = \case
1170 ) 1184 )
1171 $ foldl SAppV (SVar (debugSI "23", ".ct") $ length cs + inum + 1) $ downToS 1 inum ++ [SVar (debugSI "24", ".24") 0] 1185 $ foldl SAppV (SVar (debugSI "23", ".ct") $ length cs + inum + 1) $ downToS 1 inum ++ [SVar (debugSI "24", ".24") 0]
1172 ) 1186 )
1173 addToEnv (fst s, caseName (snd s)) (lamify ct $ \xs -> evalCaseFun cfn (init xs) (last xs), ct) 1187 addToEnv (fst s, caseName (snd s)) (lamify ct $ \xs -> evalCaseFun cfn (init $ drop (length ps) xs) (last xs), ct)
1174 let ps' = fst $ getParams vty 1188 let ps' = fst $ getParams vty
1175 t = (TType :~> TType) 1189 t = (TType :~> TType)
1176 :~> addParams ps' (Var (length ps') `app_` TyCon tcn (downTo 0 $ length ps')) 1190 :~> addParams ps' (Var (length ps') `app_` TyCon tcn (downTo 0 $ length ps'))
@@ -1184,7 +1198,11 @@ handleStmt defs = \case
1184mkELet (False, n, mf, ar) x xt = x 1198mkELet (False, n, mf, ar) x xt = x
1185mkELet (True, n, SData mf, ar) x t{-type of x-} = term 1199mkELet (True, n, SData mf, ar) x t{-type of x-} = term
1186 where 1200 where
1187 term = pmLabel (addLams' ar t 0) $ par ar t x 0 1201 term = pmLabel (FunName (snd n) mf t) (addLams'' ar t) [] $ par ar t x 0
1202
1203 addLams'' [] _ = 0
1204 addLams'' (h: ar) (Pi h' d t) | h == h' = 1 + addLams'' ar t
1205 addLams'' ar@(Visible: _) (Pi h@Hidden d t) = 1 + addLams'' ar t
1188 1206
1189 addLams' [] _ i = Fun (FunName (snd n) mf t) $ downTo 0 i 1207 addLams' [] _ i = Fun (FunName (snd n) mf t) $ downTo 0 i
1190 addLams' (h: ar) (Pi h' d t) i | h == h' = Lam $ addLams' ar t (i+1) 1208 addLams' (h: ar) (Pi h' d t) i | h == h' = Lam $ addLams' ar t (i+1)
@@ -1366,7 +1384,7 @@ instance MkDoc Neutral where
1366 where 1384 where
1367 g = mkDoc ts 1385 g = mkDoc ts
1368 f = \case 1386 f = \case
1369 PMLabel_ x _ -> g x 1387 PMLabel_ s i xs _ -> foldl (shApp Visible) (shAtom_ $ show s) <$> mapM g xs
1370 Var_ k -> shAtom <$> shVar k 1388 Var_ k -> shAtom <$> shVar k
1371 App_ a b -> shApp Visible <$> g a <*> g b 1389 App_ a b -> shApp Visible <$> g a <*> g b
1372 CstrT' TType a b -> shCstr <$> g a <*> g b 1390 CstrT' TType a b -> shCstr <$> g a <*> g b
diff --git a/testdata/Prelude.out b/testdata/Prelude.out
index 0920bc2d..1ce1896f 100644
--- a/testdata/Prelude.out
+++ b/testdata/Prelude.out
@@ -329,7 +329,7 @@ testdata/Prelude.lc 102:6-103:40 Type
329testdata/Prelude.lc 102:22-102:36 Type 329testdata/Prelude.lc 102:22-102:36 Type
330testdata/Prelude.lc 102:23-102:29 Type 330testdata/Prelude.lc 102:23-102:29 Type
331testdata/Prelude.lc 102:31-102:35 Type 331testdata/Prelude.lc 102:31-102:35 Type
332testdata/Prelude.lc 103:7-103:17 RecordC V2 | Type | {a : List (Tuple2 String Type)} -> 'tuptype ('map (Tuple2 String Type) Type (\b:Type -> 'snd String Type b) a) -> RecordC a 332testdata/Prelude.lc 103:7-103:17 RecordC V2 | Type | {a : List (Tuple2 String Type)} -> 'tuptype ('map (Tuple2 String Type) Type ('snd String Type) a) -> RecordC a
333testdata/Prelude.lc 103:18-103:40 Type 333testdata/Prelude.lc 103:18-103:40 Type
334testdata/Prelude.lc 103:19-103:26 List Type -> Type 334testdata/Prelude.lc 103:19-103:26 List Type -> Type
335testdata/Prelude.lc 103:27-103:39 List Type 335testdata/Prelude.lc 103:27-103:39 List Type
@@ -434,16 +434,16 @@ testdata/Prelude.lc 169:45-170:164 List V2 -> V2 | V1 -> List V2 -> V2 | V10 |
434testdata/Prelude.lc 169:51-169:52 String 434testdata/Prelude.lc 169:51-169:52 String
435testdata/Prelude.lc 169:51-169:56 String->Bool 435testdata/Prelude.lc 169:51-169:56 String->Bool
436testdata/Prelude.lc 169:51-169:59 Bool 436testdata/Prelude.lc 169:51-169:59 Bool
437testdata/Prelude.lc 169:51-170:164 'tuptype ('map (Tuple2 String Type) Type (\a:Type -> 'snd String Type a) V1) -> V1 | V13 437testdata/Prelude.lc 169:51-170:164 'tuptype ('map (Tuple2 String Type) Type ('snd String Type) V1) -> V1 | V13
438testdata/Prelude.lc 169:53-169:56 {a} -> {b : Eq a} -> a -> a->Bool 438testdata/Prelude.lc 169:53-169:56 {a} -> {b : Eq a} -> a -> a->Bool
439testdata/Prelude.lc 169:57-169:59 V6 439testdata/Prelude.lc 169:57-169:59 V6
440testdata/Prelude.lc 169:62-169:65 {a} -> {b} -> Tuple2 a b -> a 440testdata/Prelude.lc 169:62-169:65 {a} -> {b} -> Tuple2 a b -> a
441testdata/Prelude.lc 169:62-169:113 V15 441testdata/Prelude.lc 169:62-169:113 V15
442testdata/Prelude.lc 169:62-170:164 Bool->V16 442testdata/Prelude.lc 169:62-170:164 Bool->V16
443testdata/Prelude.lc 169:66-169:113 Tuple2 V15 ('tuptype ('map (Tuple2 String Type) Type (\a:Type -> 'snd String Type a) V8)) 443testdata/Prelude.lc 169:66-169:113 Tuple2 V15 ('tuptype ('map (Tuple2 String Type) Type ('snd String Type) V8))
444testdata/Prelude.lc 169:67-169:79 {a} -> {b} -> a->b 444testdata/Prelude.lc 169:67-169:79 {a} -> {b} -> a->b
445testdata/Prelude.lc 169:67-169:82 {a} -> V1->a 445testdata/Prelude.lc 169:67-169:82 {a} -> V1->a
446testdata/Prelude.lc 169:67-169:109 V0 -> Tuple2 V19 ('tuptype ('map (Tuple2 String Type) Type (\b:Type -> 'snd String Type b) V12)) 446testdata/Prelude.lc 169:67-169:109 V0 -> Tuple2 V19 ('tuptype ('map (Tuple2 String Type) Type ('snd String Type) V12))
447testdata/Prelude.lc 169:84-169:109 Type 447testdata/Prelude.lc 169:84-169:109 Type
448testdata/Prelude.lc 169:85-169:86 Type 448testdata/Prelude.lc 169:85-169:86 Type
449testdata/Prelude.lc 169:88-169:95 List Type -> Type 449testdata/Prelude.lc 169:88-169:95 List Type -> Type
@@ -453,7 +453,7 @@ testdata/Prelude.lc 169:97-169:100 {a} -> {b} -> a->b -> List a -> List b
453testdata/Prelude.lc 169:97-169:104 List (Tuple2 V0 V1) -> List V2 453testdata/Prelude.lc 169:97-169:104 List (Tuple2 V0 V1) -> List V2
454testdata/Prelude.lc 169:101-169:104 {a} -> {b} -> Tuple2 a b -> b 454testdata/Prelude.lc 169:101-169:104 {a} -> {b} -> Tuple2 a b -> b
455testdata/Prelude.lc 169:105-169:107 List (Tuple2 String Type) 455testdata/Prelude.lc 169:105-169:107 List (Tuple2 String Type)
456testdata/Prelude.lc 169:110-169:112 'tuptype ('map (Tuple2 String Type) Type (\a:Type -> 'snd String Type a) V3) 456testdata/Prelude.lc 169:110-169:112 'tuptype ('map (Tuple2 String Type) Type ('snd String Type) V3)
457testdata/Prelude.lc 170:51-170:58 {a} -> {b : List (Tuple2 String Type)} -> c:String -> {d : 'isKeyC String 'TT c a b} -> RecordC b -> a 457testdata/Prelude.lc 170:51-170:58 {a} -> {b : List (Tuple2 String Type)} -> c:String -> {d : 'isKeyC String 'TT c a b} -> RecordC b -> a
458testdata/Prelude.lc 170:51-170:61 {a : List (Tuple2 String Type)} -> b:String -> {c : 'isKeyC String 'TT b V19 a} -> RecordC a -> V21 458testdata/Prelude.lc 170:51-170:61 {a : List (Tuple2 String Type)} -> b:String -> {c : 'isKeyC String 'TT b V19 a} -> RecordC a -> V21
459testdata/Prelude.lc 170:51-170:65 a:String -> {b : 'isKeyC String 'TT a V17 V10} -> RecordC V11 -> V19 459testdata/Prelude.lc 170:51-170:65 a:String -> {b : 'isKeyC String 'TT a V17 V10} -> RecordC V11 -> V19
@@ -473,13 +473,13 @@ testdata/Prelude.lc 170:89-170:90 String
473testdata/Prelude.lc 170:91-170:92 Type 473testdata/Prelude.lc 170:91-170:92 Type
474testdata/Prelude.lc 170:93-170:95 List (Tuple2 String Type) 474testdata/Prelude.lc 170:93-170:95 List (Tuple2 String Type)
475testdata/Prelude.lc 170:98-170:164 RecordC V1 475testdata/Prelude.lc 170:98-170:164 RecordC V1
476testdata/Prelude.lc 170:99-170:109 {a : List (Tuple2 String Type)} -> 'tuptype ('map (Tuple2 String Type) Type (\b:Type -> 'snd String Type b) a) -> RecordC a 476testdata/Prelude.lc 170:99-170:109 {a : List (Tuple2 String Type)} -> 'tuptype ('map (Tuple2 String Type) Type ('snd String Type) a) -> RecordC a
477testdata/Prelude.lc 170:110-170:163 'tuptype ('map (Tuple2 String Type) Type (\a:Type -> 'snd String Type a) V9) 477testdata/Prelude.lc 170:110-170:163 'tuptype ('map (Tuple2 String Type) Type ('snd String Type) V9)
478testdata/Prelude.lc 170:111-170:114 {a} -> {b} -> Tuple2 a b -> b 478testdata/Prelude.lc 170:111-170:114 {a} -> {b} -> Tuple2 a b -> b
479testdata/Prelude.lc 170:115-170:162 Tuple2 V16 ('tuptype ('map (Tuple2 String Type) Type (\a:Type -> 'snd String Type a) V9)) 479testdata/Prelude.lc 170:115-170:162 Tuple2 V16 ('tuptype ('map (Tuple2 String Type) Type ('snd String Type) V9))
480testdata/Prelude.lc 170:116-170:128 {a} -> {b} -> a->b 480testdata/Prelude.lc 170:116-170:128 {a} -> {b} -> a->b
481testdata/Prelude.lc 170:116-170:131 {a} -> V1->a 481testdata/Prelude.lc 170:116-170:131 {a} -> V1->a
482testdata/Prelude.lc 170:116-170:158 V0 -> Tuple2 V20 ('tuptype ('map (Tuple2 String Type) Type (\b:Type -> 'snd String Type b) V13)) 482testdata/Prelude.lc 170:116-170:158 V0 -> Tuple2 V20 ('tuptype ('map (Tuple2 String Type) Type ('snd String Type) V13))
483testdata/Prelude.lc 170:133-170:158 Type 483testdata/Prelude.lc 170:133-170:158 Type
484testdata/Prelude.lc 170:134-170:135 Type 484testdata/Prelude.lc 170:134-170:135 Type
485testdata/Prelude.lc 170:137-170:144 List Type -> Type 485testdata/Prelude.lc 170:137-170:144 List Type -> Type
@@ -489,7 +489,7 @@ testdata/Prelude.lc 170:146-170:149 {a} -> {b} -> a->b -> List a -> List b
489testdata/Prelude.lc 170:146-170:153 List (Tuple2 V0 V1) -> List V2 489testdata/Prelude.lc 170:146-170:153 List (Tuple2 V0 V1) -> List V2
490testdata/Prelude.lc 170:150-170:153 {a} -> {b} -> Tuple2 a b -> b 490testdata/Prelude.lc 170:150-170:153 {a} -> {b} -> Tuple2 a b -> b
491testdata/Prelude.lc 170:154-170:156 List (Tuple2 String Type) 491testdata/Prelude.lc 170:154-170:156 List (Tuple2 String Type)
492testdata/Prelude.lc 170:159-170:161 'tuptype ('map (Tuple2 String Type) Type (\a:Type -> 'snd String Type a) V4) 492testdata/Prelude.lc 170:159-170:161 'tuptype ('map (Tuple2 String Type) Type ('snd String Type) V4)
493testdata/Prelude.lc 174:1-174:4 Float -> Float -> Float -> VecS Float 4 493testdata/Prelude.lc 174:1-174:4 Float -> Float -> Float -> VecS Float 4
494testdata/Prelude.lc 174:13-174:15 {a} -> a -> a -> a -> a -> VecS a 4 494testdata/Prelude.lc 174:13-174:15 {a} -> a -> a -> a -> a -> VecS a 4
495testdata/Prelude.lc 174:13-174:17 V5 -> V6 -> V7 -> VecS V8 4 495testdata/Prelude.lc 174:13-174:17 V5 -> V6 -> V7 -> VecS V8 4
diff --git a/testdata/language-features/adt/adt05.out b/testdata/language-features/adt/adt05.out
index 29167f4f..97b40b5c 100644
--- a/testdata/language-features/adt/adt05.out
+++ b/testdata/language-features/adt/adt05.out
@@ -1 +1 @@
main \ No newline at end of file main \ No newline at end of file