summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/LambdaCube/Compiler/Infer.hs254
-rw-r--r--testdata/Builtins.out148
-rw-r--r--testdata/Internals.out20
-rw-r--r--testdata/Material.out76
-rw-r--r--testdata/Prelude.out7
-rw-r--r--testdata/ambig.out3
-rw-r--r--testdata/complex.out6
-rw-r--r--testdata/data.out34
-rw-r--r--testdata/language-features/basic-values/data01.out7
-rw-r--r--testdata/traceTest.out2
-rw-r--r--testdata/typeclass.out4
11 files changed, 407 insertions, 154 deletions
diff --git a/src/LambdaCube/Compiler/Infer.hs b/src/LambdaCube/Compiler/Infer.hs
index 7e6bc883..405bb06a 100644
--- a/src/LambdaCube/Compiler/Infer.hs
+++ b/src/LambdaCube/Compiler/Infer.hs
@@ -69,7 +69,7 @@ data Stmt
69 = Let SIName MFixity (Maybe SExp) [Visibility]{-source arity-} SExp 69 = Let SIName MFixity (Maybe SExp) [Visibility]{-source arity-} SExp
70 | Data SIName [(Visibility, SExp)]{-parameters-} SExp{-type-} Bool{-True:add foralls-} [(SIName, SExp)]{-constructor names and types-} 70 | Data SIName [(Visibility, SExp)]{-parameters-} SExp{-type-} Bool{-True:add foralls-} [(SIName, SExp)]{-constructor names and types-}
71 | PrecDef SIName Fixity 71 | PrecDef SIName Fixity
72 | ValueDef ([SName], Pat) SExp 72 | ValueDef ([SIName], Pat) SExp
73 | TypeFamily SIName [(Visibility, SExp)]{-parameters-} SExp{-type-} 73 | TypeFamily SIName [(Visibility, SExp)]{-parameters-} SExp{-type-}
74 74
75 -- eliminated during parsing 75 -- eliminated during parsing
@@ -1156,8 +1156,8 @@ getParams x = ([], x)
1156getLams (Lam h a b) = ((h, a):) *** id $ getLams b 1156getLams (Lam h a b) = ((h, a):) *** id $ getLams b
1157getLams x = ([], x) 1157getLams x = ([], x)
1158 1158
1159apps a b = foldl SAppV{-SI todo-} (SGlobal ((debugSI "8"){-todo-}, a)) b 1159apps a b = foldl SAppV{-SI todo-} (SGlobal a) b
1160apps' a b = foldl sapp{-SI todo-} (SGlobal ((debugSI "9"){-todo-}, a)) b 1160apps' a b = foldl sapp{-SI todo-} (SGlobal a) b
1161 1161
1162replaceMetas err bind = \case 1162replaceMetas err bind = \case
1163 Meta a t -> bind Hidden a <$> replaceMetas err bind t 1163 Meta a t -> bind Hidden a <$> replaceMetas err bind t
@@ -1331,14 +1331,14 @@ handleStmt exs = \case
1331 addToEnv exs (si, cn) (Con conn [], cty) 1331 addToEnv exs (si, cn) (Con conn [], cty)
1332 return ( conn 1332 return ( conn
1333 , addParamsS pars 1333 , addParamsS pars
1334 $ foldl SAppV (SVar (debugSI "22", ".cs") $ j + length pars) $ drop pnum' xs ++ [apps' cn (zip acts $ downToS (j+1+length pars) (length ps) ++ downToS 0 (act- length ps))] 1334 $ foldl SAppV (SVar (debugSI "22", ".cs") $ j + length pars) $ drop pnum' xs ++ [apps' (si, cn) (zip acts $ downToS (j+1+length pars) (length ps) ++ downToS 0 (act- length ps))]
1335 ) 1335 )
1336 | otherwise = throwError $ "illegal data definition (parameters are not uniform) " -- ++ show (c, cn, take pnum' xs, act) 1336 | otherwise = throwError $ "illegal data definition (parameters are not uniform) " -- ++ show (c, cn, take pnum' xs, act)
1337 where 1337 where
1338 (c, map snd -> xs) = getApps $ snd $ getParamsS ct 1338 (c, map snd -> xs) = getApps $ snd $ getParamsS ct
1339 1339
1340 motive = addParamsS (replicate inum (Visible, Wildcard SType)) $ 1340 motive = addParamsS (replicate inum (Visible, Wildcard SType)) $
1341 SPi Visible (apps' s $ zip (map fst ps) (downToS inum $ length ps) ++ zip (map fst $ fst $ getParamsS t_) (downToS 0 inum)) SType 1341 SPi Visible (apps' (si, s) $ zip (map fst ps) (downToS inum $ length ps) ++ zip (map fst $ fst $ getParamsS t_) (downToS 0 inum)) SType
1342 1342
1343 mdo 1343 mdo
1344 let tcn = TyConName s Nothing inum vty (map fst cons) ct 1344 let tcn = TyConName s Nothing inum vty (map fst cons) ct
@@ -1350,7 +1350,7 @@ handleStmt exs = \case
1350 ++ (Visible, motive) 1350 ++ (Visible, motive)
1351 : map ((,) Visible . snd) cons 1351 : map ((,) Visible . snd) cons
1352 ++ replicate inum (Hidden, Wildcard SType) 1352 ++ replicate inum (Hidden, Wildcard SType)
1353 ++ [(Visible, apps' s $ zip (map fst ps) (downToS (inum + length cs + 1) $ length ps) ++ zip (map fst $ fst $ getParamsS t_) (downToS 0 inum))] 1353 ++ [(Visible, apps' (si, s) $ zip (map fst ps) (downToS (inum + length cs + 1) $ length ps) ++ zip (map fst $ fst $ getParamsS t_) (downToS 0 inum))]
1354 ) 1354 )
1355 $ foldl SAppV (SVar (debugSI "23", ".ct") $ length cs + inum + 1) $ downToS 1 inum ++ [SVar (debugSI "24", ".24") 0] 1355 $ foldl SAppV (SVar (debugSI "23", ".ct") $ length cs + inum + 1) $ downToS 1 inum ++ [SVar (debugSI "24", ".24") 0]
1356 ) 1356 )
@@ -1513,7 +1513,7 @@ fixityDef = do
1513 <|> InfixR <$ reserved "infixr" 1513 <|> InfixR <$ reserved "infixr"
1514 localIndentation Gt $ do 1514 localIndentation Gt $ do
1515 i <- fromIntegral <$> natural 1515 i <- fromIntegral <$> natural
1516 ns <- commaSep1 (siName operatorT) 1516 ns <- commaSep1 (withSI operatorT)
1517 return $ PrecDef <$> ns <*> pure (dir, i) 1517 return $ PrecDef <$> ns <*> pure (dir, i)
1518 1518
1519-------------------------------------------------------------------------------- export 1519-------------------------------------------------------------------------------- export
@@ -1615,44 +1615,54 @@ parseLC f str = either (throwError . ErrorMsg . show) return . flip runReader (e
1615 1615
1616-------------------------------------------------------------------------------- 1616--------------------------------------------------------------------------------
1617 1617
1618parseType ns mb vs = maybe id option mb $ reservedOp "::" *> (dbf' vs <$> parseTTerm ns PrecLam) 1618parseType ns mb = maybe id option mb (reservedOp "::" *> parseTTerm ns PrecLam)
1619typedIds ns mb vs = (,) <$> commaSep1 (siName (varId ns <|> patVar ns <|> upperCase ns)) 1619typedIds ns mb = (,) <$> commaSep1 (withSI (varId ns <|> patVar ns <|> upperCase ns))
1620 <*> localIndentation Gt {-TODO-} (parseType ns mb vs) 1620 <*> localIndentation Gt {-TODO-} (parseType ns mb)
1621 1621
1622telescope ns mb = (removeSI *** id) <$> telescopeSI ns mb [] 1622telescope ns mb = (DBNamesC *** id) <$> telescopeSI ns mb
1623
1624telescopeSI :: Namespace -> Maybe SExp -> [SIName] -> P ([SIName], [(Visibility, SExp)]) -- todo: refactor to [(SIName, (Visibility, SExp))]
1625telescopeSI ns mb vs = option (vs, []) $ do
1626 (si, (x, vt)) <- withSI
1627 ( reservedOp "@" *> (maybe empty (\x -> flip (,) (Hidden, x) <$> patVar ns) mb <|> parens (typedId Hidden))
1628 <|> try (parens $ typedId Visible)
1629 <|> maybe ((,) "" . (,) Visible . dbf' (removeSI vs) <$> parseTerm ns PrecAtom)
1630 (\x -> flip (,) (Visible, x) <$> patVar ns)
1631 mb
1632 )
1633 (second (vt:)) <$> telescopeSI ns mb ((si, x): vs)
1634 where
1635 typedId v = (\f s -> (f,(v,s)))
1636 <$> patVar ns
1637 <*> localIndentation Gt {-TODO-} (parseType ns mb (removeSI vs))
1638 1623
1639removeSI = DBNamesC . map snd 1624telescopeSI :: Namespace -> Maybe SExp -> P ([SIName], [(Visibility, SExp)]) -- todo: refactor to [(SIName, (Visibility, SExp))]
1625telescopeSI ns mb = go []
1626 where
1627 go vs = option ([], []) $ do
1628 (x, vt) <-
1629 ( reservedOp "@" *> (maybe empty (\x -> flip (,) (Hidden, x) <$> withSI (patVar ns)) mb <|> parens (typedId Hidden))
1630 <|> try (parens $ typedId Visible)
1631 <|> maybe ((,) (debugSI "s13", "") . (,) Visible . dbf' (DBNamesC vs) <$> parseTerm ns PrecAtom)
1632 (\x -> flip (,) (Visible, x) <$> withSI (patVar ns))
1633 mb
1634 )
1635 ((++[x]) *** (vt:)) <$> go (x: vs)
1636 where
1637 typedId v = (\f s -> (f,(v,s)))
1638 <$> withSI (patVar ns)
1639 <*> localIndentation Gt {-TODO-} (dbf' (DBNamesC vs) <$> parseType ns mb)
1640 1640
1641parseClause ns e = do 1641telescopeDataFields :: Namespace -> P ([SIName], [(Visibility, SExp)])
1642 (fe, p) <- pattern' ns e 1642telescopeDataFields ns = {-telescopeSI ns Nothing-} go []
1643 where
1644 go vs = option ([], []) $ do
1645 (x, vt) <- do name <- withSI $ var (expNS ns)
1646 term <- parseType ns Nothing
1647 return (name, (Visible, dbf' (DBNamesC vs) term))
1648 ((++[x]) *** (vt:)) <$> (comma *> go (x: vs) <|> pure ([], []))
1649
1650parseClause ns = do
1651 (fe, p) <- pattern' ns
1643 localIndentation Gt $ do 1652 localIndentation Gt $ do
1644 x <- reservedOp "->" *> (dbf' fe <$> parseETerm ns PrecLam) 1653 x <- reservedOp "->" *> parseETerm ns PrecLam
1645 f <- parseWhereBlock ns 1654 f <- parseWhereBlock ns
1646 return (p, dbf' fe $ f x) 1655 return (p, dbf' fe $ f x)
1647 1656
1648patternAtom ns vs = 1657patternAtom ns = patternAtom' ns <&> \p -> (getPVars p, p)
1649 (,) vs . flip ViewPat eqPP . SAppV (SGlobal (debugSI "patternAtom1","primCompareFloat")) <$> sLit `withRange` (LFloat <$> try float) 1658patternAtom' ns =
1650 <|> (,) vs . mkNatPat ns <$> (withSI natural) 1659 flip ViewPat eqPP . SAppV (SGlobal (debugSI "patternAtom1","primCompareFloat")) <$> sLit `withRange` (LFloat <$> try float)
1651 <|> (,) vs . flip PCon [] <$> (siName $ upperCase ns) 1660 <|> mkNatPat ns <$> (withSI natural)
1652 <|> char '\'' *> patternAtom (switchNS ns) vs 1661 <|> flip PCon [] <$> (withSI $ upperCase ns)
1653 <|> (\sn@(si, n) -> (addDBName n vs, PVar sn)) <$> withSI (patVar ns) 1662 <|> char '\'' *> patternAtom' (switchNS ns)
1654 <|> (id *** (pConSI . mkListPat ns)) <$> brackets (patlist ns vs <|> pure (vs, [])) 1663 <|> PVar <$> withSI (patVar ns)
1655 <|> (id *** (pConSI . mkTupPat ns)) <$> parens (patlist ns vs) 1664 <|> pConSI . mkListPat ns <$> brackets (patlist ns <|> pure [])
1665 <|> pConSI . mkTupPat ns <$> parens (patlist ns)
1656 where 1666 where
1657 mkNatPat (Namespace ExpLevel _) (si, n) = flip ViewPat eqPP . SAppV (SGlobal (debugSI "patternAtom2","primCompareInt")) . sLit si . LInt $ fromIntegral n 1667 mkNatPat (Namespace ExpLevel _) (si, n) = flip ViewPat eqPP . SAppV (SGlobal (debugSI "patternAtom2","primCompareInt")) . sLit si . LInt $ fromIntegral n
1658 mkNatPat _ (si, n) = toNatP si n 1668 mkNatPat _ (si, n) = toNatP si n
@@ -1662,7 +1672,7 @@ patternAtom ns vs =
1662eqPP = ParPat [PCon (debugSI "eqPP", "EQ") []] 1672eqPP = ParPat [PCon (debugSI "eqPP", "EQ") []]
1663truePP = ParPat [PCon (debugSI "truePP", "True") []] 1673truePP = ParPat [PCon (debugSI "truePP", "True") []]
1664 1674
1665patlist ns vs = commaSepUnfold (\vs -> (\(vs, p) t -> (vs, patType p t)) <$> pattern' ns vs <*> parseType ns (Just $ Wildcard SType) vs) vs 1675patlist ns = fmap snd $ commaSepUnfold (\vs -> (\(vs, p) t -> (vs, patType (dbPat vs p) t)) <$> pattern' ns <*> (dbf' vs <$> parseType ns (Just $ Wildcard SType))) mempty
1666 1676
1667mkListPat ns [p] | namespaceLevel ns == Just TypeLevel = PCon (debugSI "mkListPat4", "'List") [ParPat [p]] 1677mkListPat ns [p] | namespaceLevel ns == Just TypeLevel = PCon (debugSI "mkListPat4", "'List") [ParPat [p]]
1668mkListPat ns (p: ps) = PCon (debugSI "mkListPat2", "Cons") $ map (ParPat . (:[])) [p, mkListPat ns ps] 1678mkListPat ns (p: ps) = PCon (debugSI "mkListPat2", "Cons") $ map (ParPat . (:[])) [p, mkListPat ns ps]
@@ -1672,37 +1682,42 @@ mkTupPat :: Namespace -> [Pat] -> Pat
1672mkTupPat _ [x] = x 1682mkTupPat _ [x] = x
1673mkTupPat ns ps = PCon (debugSI "", tick' ns $ "Tuple" ++ show (length ps)) (ParPat . (:[]) <$> ps) 1683mkTupPat ns ps = PCon (debugSI "", tick' ns $ "Tuple" ++ show (length ps)) (ParPat . (:[]) <$> ps)
1674 1684
1675pattern' ns vs = 1685pattern' ns = pattern'_ ns <&> \p -> (getPVars p, p)
1676 pCon <$> (siName $ upperCase ns) <*> patterns ns vs 1686pattern'_ ns =
1677 <|> pCon <$> try (withSI (char '\'' *> upperCase (switchNS ns))) <*> patterns ns vs 1687 PCon <$> (withSI $ upperCase ns) <*> patterns' ns
1678 <|> (patternAtom ns vs >>= \(vs, p) -> option (vs, p) ((id *** (\p' -> PCon (debugSI "pattern'","Cons") (ParPat . (:[]) <$> [p, p']))) <$ reservedOp ":" <*> pattern' ns vs)) 1688 <|> PCon <$> try (withSI (char '\'' *> upperCase (switchNS ns))) <*> patterns' ns
1689 <|> (patternAtom ns >>= \(vs, p) -> option p (((\p' -> PCon (debugSI "pattern'","Cons") (ParPat . (:[]) <$> [p, p']))) <$ reservedOp ":" <*> (dbPat vs <$> pattern'_ ns)))
1690
1691dbPat v = mapP (dbf' v)
1679 1692
1680pCon i (vs, x) = (vs, PCon i x) 1693pCon i (vs, x) = (vs, PCon i x)
1681 1694
1682patterns ns vs = 1695patterns ns = patterns' ns <&> \p -> (foldMap getPPVars p, p)
1683 do patternAtom ns vs >>= \(vs, p) -> patterns ns vs >>= \(vs, ps) -> pure (vs, ParPat [p]: ps) 1696patterns' ns = fmap snd $
1684 <|> pure (vs, []) 1697 do patternAtom ns >>= \(vs, p) -> patterns ns >>= \(vs', ps) -> pure (vs' <> vs, ParPat [p]: map (mapPP $ dbf' vs) ps)
1698 <|> pure (mempty, [])
1685 1699
1686patType p (Wildcard SType) = p 1700patType p (Wildcard SType) = p
1687patType p t = PatType (ParPat [p]) t 1701patType p t = PatType (ParPat [p]) t
1688 1702
1689commaSepUnfold1 :: (t -> P (t, a)) -> t -> P (t, [a]) 1703-- todo: eliminate
1690commaSepUnfold1 p vs0 = do
1691 (vs1, x) <- p vs0
1692 (second (x:) <$ comma <*> commaSepUnfold1 p vs1) <|> pure (vs1, [x])
1693
1694commaSepUnfold :: (t -> P (t, a)) -> t -> P (t, [a]) 1704commaSepUnfold :: (t -> P (t, a)) -> t -> P (t, [a])
1695commaSepUnfold p vs = commaSepUnfold1 p vs <|> pure (vs, []) 1705commaSepUnfold p vs = commaSepUnfold1 p vs <|> pure (vs, [])
1706 where
1707 commaSepUnfold1 :: (t -> P (t, a)) -> t -> P (t, [a])
1708 commaSepUnfold1 p vs0 = do
1709 (vs1, x) <- p vs0
1710 (second (x:) <$ comma <*> commaSepUnfold1 p vs1) <|> pure (vs1, [x])
1696 1711
1697telescope' ns = go mempty where 1712telescope' ns = go mempty where
1698 go vs = option (vs, []) $ do 1713 go vs = option (vs, []) $ do
1699 (vs', vt) <- 1714 (vs', vt) <-
1700 reservedOp "@" *> (f Hidden <$> patternAtom ns vs) 1715 reservedOp "@" *> (second (f Hidden . mapP (dbf' vs)) <$> patternAtom ns)
1701 <|> f Visible <$> patternAtom ns vs 1716 <|> second (f Visible . mapP (dbf' vs)) <$> patternAtom ns
1702 (id *** (vt:)) <$> go vs' 1717 (id *** (vt:)) <$> go (vs' <> vs)
1703 where 1718 where
1704 f h (vs, PatType (ParPat [p]) t) = (vs, ((h, t), p)) 1719 f h (PatType (ParPat [p]) t) = ((h, t), p)
1705 f h (vs, p) = (vs, ((h, Wildcard SType), p)) 1720 f h p = ((h, Wildcard SType), p)
1706 1721
1707parseDefs lend ns = (asks $ \ge -> compileFunAlts' lend ge . concat) <*> many (parseDef ns) 1722parseDefs lend ns = (asks $ \ge -> compileFunAlts' lend ge . concat) <*> many (parseDef ns)
1708 1723
@@ -1756,49 +1771,48 @@ parseDef :: Namespace -> P [Stmt]
1756parseDef ns = 1771parseDef ns =
1757 do reserved "data" 1772 do reserved "data"
1758 localIndentation Gt $ do 1773 localIndentation Gt $ do
1759 (si,x) <- siName $ upperCase (typeNS ns) 1774 (si,x) <- withSI $ upperCase (typeNS ns)
1760 (nps, ts) <- telescopeSI (typeNS ns) (Just SType) [] 1775 (npsd, ts) <- telescope (typeNS ns) (Just SType)
1761 let npsd@(DBNamesC npsd_) = removeSI nps 1776 t <- dbf' npsd <$> parseType (typeNS ns) (Just SType)
1762 t <- parseType (typeNS ns) (Just SType) npsd
1763 let mkConTy mk (nps', ts') = 1777 let mkConTy mk (nps', ts') =
1764 ( if mk then Just $ diffDBNames' nps' npsd_ else Nothing 1778 ( if mk then Just nps' else Nothing
1765 , foldr (uncurry SPi) (foldl SAppV (SGlobal (si,x)) $ downToS (length ts') $ length ts) ts') 1779 , foldr (uncurry SPi) (foldl SAppV (SGlobal (si,x)) $ downToS (length ts') $ length ts) ts')
1766 (af, cs) <- 1780 (af, cs) <-
1767 do (,) True <$ reserved "where" <*> localIndentation Ge (localAbsoluteIndentation $ many $ 1781 do (,) True <$ reserved "where" <*> localIndentation Ge (localAbsoluteIndentation $ many $
1768 (id *** (,) Nothing) <$> typedIds ns Nothing npsd) 1782 (id *** (,) Nothing . dbf' npsd) <$> typedIds ns Nothing)
1769 <|> do (,) False <$ reservedOp "=" <*> 1783 <|> do (,) False <$ reservedOp "=" <*>
1770 sepBy1 ((,) <$> (pure <$> siName (upperCase ns)) 1784 sepBy1 ((,) <$> (pure <$> withSI (upperCase ns))
1771 <*> ( braces (mkConTy True <$> (telescopeDataFields (typeNS ns) nps)) 1785 <*> ( braces (mkConTy True . (\(x, y) -> (x, zipWith (\i (v, e) -> (v, dbf_ i npsd e)) [0..] y)) <$> telescopeDataFields (typeNS ns))
1772 <|> (mkConTy False <$> telescopeSI (typeNS ns) Nothing nps)) ) 1786 <|> (mkConTy False . (\(x, y) -> (x, zipWith (\i (v, e) -> (v, dbf_ i npsd e)) [0..] y)) <$> telescopeSI (typeNS ns) Nothing)) )
1773 (reservedOp "|") 1787 (reservedOp "|")
1774 <|> pure (True, []) 1788 <|> pure (True, [])
1775 ge <- ask 1789 ge <- ask
1776 return $ mkData ge (si,x) ts t af $ concatMap (\(vs, t) -> (,) <$> vs <*> pure t) $ cs 1790 return $ mkData ge (si,x) ts t af $ concatMap (\(vs, t) -> (,) <$> vs <*> pure t) $ cs
1777 <|> do reserved "class" 1791 <|> do reserved "class"
1778 localIndentation Gt $ do 1792 localIndentation Gt $ do
1779 x <- siName $ upperCase (typeNS ns) 1793 x <- withSI $ upperCase (typeNS ns)
1780 (nps, ts) <- telescope (typeNS ns) (Just SType) 1794 (nps, ts) <- telescope (typeNS ns) (Just SType)
1781 cs <- 1795 cs <-
1782 do reserved "where" *> localIndentation Ge (localAbsoluteIndentation $ many $ typedIds ns Nothing nps) 1796 do reserved "where" *> localIndentation Ge (localAbsoluteIndentation $ many $ typedIds ns Nothing)
1783 <|> pure [] 1797 <|> pure []
1784 return $ pure $ Class x (map snd ts) (concatMap (\(vs, t) -> (,) <$> vs <*> pure t) cs) 1798 return $ pure $ Class x (map snd ts) (concatMap (\(vs, t) -> (,) <$> vs <*> pure (dbf' nps t)) cs)
1785 <|> do reserved "instance" 1799 <|> do reserved "instance"
1786 let ns' = typeNS ns 1800 let ns' = typeNS ns
1787 localIndentation Gt $ do 1801 localIndentation Gt $ do
1788 constraints <- option [] $ try $ getTTuple' <$> parseTerm ns' PrecEq <* reservedOp "=>" 1802 constraints <- option [] $ try $ getTTuple' <$> parseTerm ns' PrecEq <* reservedOp "=>"
1789 (si,x) <- siName $ upperCase ns' 1803 (si,x) <- withSI $ upperCase ns'
1790 (nps, args) <- telescope' ns' 1804 (nps, args) <- telescope' ns'
1791 cs <- option [] $ reserved "where" *> localIndentation Ge (localAbsoluteIndentation $ some $ 1805 cs <- option [] $ reserved "where" *> localIndentation Ge (localAbsoluteIndentation $ some $
1792 dbFunAlt nps <$> funAltDef (varId ns) ns) 1806 dbFunAlt nps <$> funAltDef (varId ns) ns)
1793 <|> pure [] 1807 <|> pure []
1794 ge <- ask 1808 ge <- ask
1795 return $ pure $ Instance (si,x) ({-todo-}map snd args) (dbf (diffDBNames nps ++ [x]) <$> constraints) $ compileFunAlts' id{-TODO-} ge cs 1809 return $ pure $ Instance (si,x) ({-todo-}map snd args) (dbff (diffDBNames nps ++ [x]) <$> constraints) $ compileFunAlts' id{-TODO-} ge cs
1796 <|> do try (reserved "type" >> reserved "family") 1810 <|> do try (reserved "type" >> reserved "family")
1797 let ns' = typeNS ns 1811 let ns' = typeNS ns
1798 localIndentation Gt $ do 1812 localIndentation Gt $ do
1799 (si, x) <- siName $ upperCase ns' 1813 (si, x) <- withSI $ upperCase ns'
1800 (nps, ts) <- telescope ns' (Just SType) 1814 (nps, ts) <- telescope ns' (Just SType)
1801 t <- parseType ns' (Just SType) nps 1815 t <- dbf' nps <$> parseType ns' (Just SType)
1802 option {-open type family-}[TypeFamily (si, x) ts t] $ do 1816 option {-open type family-}[TypeFamily (si, x) ts t] $ do
1803 cs <- reserved "where" *> localIndentation Ge (localAbsoluteIndentation $ many $ 1817 cs <- reserved "where" *> localIndentation Ge (localAbsoluteIndentation $ many $
1804 funAltDef (upperCase ns' >>= \x' -> guard (x == x') >> return x') ns') 1818 funAltDef (upperCase ns' >>= \x' -> guard (x == x') >> return x') ns')
@@ -1808,42 +1822,36 @@ parseDef ns =
1808 <|> do reserved "type" 1822 <|> do reserved "type"
1809 let ns' = typeNS ns 1823 let ns' = typeNS ns
1810 localIndentation Gt $ do 1824 localIndentation Gt $ do
1811 (si, x) <- siName $ upperCase ns' 1825 (si, x) <- withSI $ upperCase ns'
1812 (nps, ts) <- telescopeSI ns' (Just (Wildcard SType)) [] 1826 (nps, ts) <- telescopeSI ns' (Just (Wildcard SType))
1813 reservedOp "=" 1827 reservedOp "="
1814 rhs <- dbf' (removeSI nps) <$> parseTerm ns' PrecLam 1828 rhs <- dbf' (DBNamesC nps) <$> parseTerm ns' PrecLam
1815 ge <- ask 1829 ge <- ask
1816 return $ compileFunAlts False id SLabelEnd ge [{-TypeAnn (si, x) $ addParamsS ts $ SType-}{-todo-}] [FunAlt (si, x) (reverse $ zip (reverse ts) $ map PVar nps) Nothing rhs] 1830 return $ compileFunAlts False id SLabelEnd ge
1831 [{-TypeAnn (si, x) $ addParamsS ts $ SType-}{-todo-}]
1832 [FunAlt (si, x) (reverse $ zip (reverse ts) $ map PVar nps) Nothing rhs]
1817 <|> do try (reserved "type" >> reserved "instance") 1833 <|> do try (reserved "type" >> reserved "instance")
1818 let ns' = typeNS ns 1834 let ns' = typeNS ns
1819 pure <$> localIndentation Gt (funAltDef (upperCase ns') ns') 1835 pure <$> localIndentation Gt (funAltDef (upperCase ns') ns')
1820 <|> do (vs, t) <- try $ typedIds ns Nothing mempty 1836 <|> do (vs, t) <- try $ typedIds ns Nothing
1821 return $ TypeAnn <$> vs <*> pure t 1837 return $ TypeAnn <$> vs <*> pure t
1822 <|> fixityDef 1838 <|> fixityDef
1823 <|> pure <$> funAltDef (varId ns) ns 1839 <|> pure <$> funAltDef (varId ns) ns
1824 <|> pure . uncurry ValueDef <$> valueDef ns 1840 <|> pure . uncurry ValueDef <$> valueDef ns
1825 where
1826 telescopeDataFields :: Namespace -> [SIName] -> P ([SIName], [(Visibility, SExp)])
1827 telescopeDataFields ns vs = option (vs, []) $ do
1828 (x, vt) <- do name <- siName $ var (expNS ns)
1829 reservedOp "::"
1830 term <- dbf' (removeSI vs) <$> parseTerm ns PrecLam
1831 return (name, (Visible, term))
1832 (id *** (vt:)) <$> (comma *> telescopeDataFields ns (x: vs) <|> pure (vs, []))
1833 1841
1834funAltDef parseName ns = do -- todo: use ns to determine parseName 1842funAltDef parseName ns = do -- todo: use ns to determine parseName
1835 (n, (fee, tss)) <- 1843 (n, (fee, tss)) <-
1836 do try' "operator definition" $ do 1844 do try' "operator definition" $ do
1837 (e', a1) <- patternAtom ns mempty 1845 (e', a1) <- patternAtom ns
1838 localIndentation Gt $ do 1846 localIndentation Gt $ do
1839 n <- siName operatorT 1847 n <- withSI operatorT
1840 (e'', a2) <- patternAtom ns e' 1848 (e'', a2) <- patternAtom ns
1841 lookAhead $ reservedOp "=" <|> reservedOp "|" 1849 lookAhead $ reservedOp "=" <|> reservedOp "|"
1842 return (n, (e'', (,) (Visible, Wildcard SType) <$> [a1, a2])) 1850 return (n, (e'' <> e', (,) (Visible, Wildcard SType) <$> [a1, mapP (dbf' e') a2]))
1843 <|> do try $ do 1851 <|> do try $ do
1844 n <- siName parseName 1852 n <- withSI parseName
1845 localIndentation Gt $ (,) n <$> telescope' ns <* (lookAhead $ reservedOp "=" <|> reservedOp "|") 1853 localIndentation Gt $ (,) n <$> telescope' ns <* (lookAhead $ reservedOp "=" <|> reservedOp "|")
1846 let fe = addDBNames (diffDBNames fee) $ addDBName (snd n) mempty 1854 let fe = dbf' $ fee <> addDBName n
1847 ts = map (id *** upP 0 1{-todo: replace n with Var 0-}) tss 1855 ts = map (id *** upP 0 1{-todo: replace n with Var 0-}) tss
1848 localIndentation Gt $ do 1856 localIndentation Gt $ do
1849 gu <- option Nothing $ do 1857 gu <- option Nothing $ do
@@ -1852,7 +1860,7 @@ funAltDef parseName ns = do -- todo: use ns to determine parseName
1852 reservedOp "=" 1860 reservedOp "="
1853 rhs <- parseTerm ns PrecLam 1861 rhs <- parseTerm ns PrecLam
1854 f <- parseWhereBlock ns 1862 f <- parseWhereBlock ns
1855 return $ FunAlt n ts (dbf' fe <$> gu) $ dbf' fe $ f rhs 1863 return $ FunAlt n ts (fe <$> gu) $ fe $ f rhs
1856 1864
1857dbFunAlt v (FunAlt n ts gu e) = FunAlt n (map (id *** mapP (dbf' v)) ts) (dbf' v <$> gu) $ dbf' v e 1865dbFunAlt v (FunAlt n ts gu e) = FunAlt n (map (id *** mapP (dbf' v)) ts) (dbf' v <$> gu) $ dbf' v e
1858 1866
@@ -1870,19 +1878,19 @@ parseWhereBlock ns = option id $ do
1870 ge <- ask 1878 ge <- ask
1871 return $ mkLets ge dcls 1879 return $ mkLets ge dcls
1872 1880
1873newtype DBNames = DBNamesC [SName] -- De Bruijn variable names 1881newtype DBNames = DBNamesC [SIName] -- De Bruijn variable names
1874instance Show DBNames where show (DBNamesC x) = show x 1882instance Show DBNames where show (DBNamesC x) = show $ map snd x
1875instance Monoid DBNames where mempty = DBNamesC [] 1883instance Monoid DBNames where mempty = DBNamesC []
1876 mappend = error "mappend @DBNames" 1884 mappend (DBNamesC a) (DBNamesC b) = DBNamesC (a ++ b)
1885
1886addDBName n = DBNamesC [n]
1887diffDBNames (DBNamesC xs) = map snd xs
1877 1888
1878addDBNames xs (DBNamesC ys) = DBNamesC $ xs ++ ys
1879addDBName n (DBNamesC ns) = DBNamesC $ n:ns
1880sVar = withRange $ \si x -> SGlobal (si, x) 1889sVar = withRange $ \si x -> SGlobal (si, x)
1881diffDBNames (DBNamesC xs) = xs
1882 1890
1883valueDef :: Namespace -> P (([SName], Pat), SExp) 1891valueDef :: Namespace -> P (([SIName], Pat), SExp)
1884valueDef ns = do 1892valueDef ns = do
1885 (DBNamesC e', p) <- try $ pattern' ns mempty <* reservedOp "=" 1893 (DBNamesC e', p) <- try $ pattern' ns <* reservedOp "="
1886 localIndentation Gt $ do 1894 localIndentation Gt $ do
1887 ex <- parseETerm ns PrecLam 1895 ex <- parseETerm ns PrecLam
1888 return ((e', p), ex) 1896 return ((e', p), ex)
@@ -1907,12 +1915,12 @@ parseTerm ns PrecLam =
1907 t' <- dbf' fe <$> parseTerm ns PrecLam 1915 t' <- dbf' fe <$> parseTerm ns PrecLam
1908 return $ \r -> foldr (uncurry (f r)) t' ts 1916 return $ \r -> foldr (uncurry (f r)) t' ts
1909 <|> do (asks compileCase) <* reserved "case" <*> parseETerm ns PrecLam 1917 <|> do (asks compileCase) <* reserved "case" <*> parseETerm ns PrecLam
1910 <* reserved "of" <*> localIndentation Ge (localAbsoluteIndentation $ some $ parseClause ns mempty) 1918 <* reserved "of" <*> localIndentation Ge (localAbsoluteIndentation $ some $ parseClause ns)
1911 <|> do (asks $ \ge -> compileGuardTree id id ge . Alts) <*> parseSomeGuards ns (const True) 1919 <|> do (asks $ \ge -> compileGuardTree id id ge . Alts) <*> parseSomeGuards ns (const True)
1912 <|> do t <- parseTerm ns PrecEq 1920 <|> do t <- parseTerm ns PrecEq
1913 option t $ mkPi <$> (Visible <$ reservedOp "->" <|> Hidden <$ reservedOp "=>") <*> pure t <*> parseTTerm ns PrecLam 1921 option t $ mkPi <$> (Visible <$ reservedOp "->" <|> Hidden <$ reservedOp "=>") <*> pure t <*> parseTTerm ns PrecLam
1914parseTerm ns PrecEq = parseTerm ns PrecAnn >>= \t -> option t $ SCstr t <$ reservedOp "~" <*> parseTTerm ns PrecAnn 1922parseTerm ns PrecEq = parseTerm ns PrecAnn >>= \t -> option t $ SCstr t <$ reservedOp "~" <*> parseTTerm ns PrecAnn
1915parseTerm ns PrecAnn = parseTerm ns PrecOp >>= \t -> option t $ SAnn t <$> parseType ns Nothing mempty 1923parseTerm ns PrecAnn = parseTerm ns PrecOp >>= \t -> option t $ SAnn t <$> parseType ns Nothing
1916parseTerm ns PrecOp = asks calculatePrecs <*> p' where 1924parseTerm ns PrecOp = asks calculatePrecs <*> p' where
1917 p' = ((\si (t, xs) -> (mkNat ns si 0, (SGlobal (debugSI "12", "-"), t): xs)) `withRange` (reservedOp "-" *> p_)) 1925 p' = ((\si (t, xs) -> (mkNat ns si 0, (SGlobal (debugSI "12", "-"), t): xs)) `withRange` (reservedOp "-" *> p_))
1918 <|> p_ 1926 <|> p_
@@ -1944,8 +1952,8 @@ parseTerm ns PrecAtom =
1944 <|> mkDotDot <$> try (reservedOp "[" *> parseTerm ns PrecLam <* reservedOp ".." ) <*> parseTerm ns PrecLam <* reservedOp "]" 1952 <|> mkDotDot <$> try (reservedOp "[" *> parseTerm ns PrecLam <* reservedOp ".." ) <*> parseTerm ns PrecLam <* reservedOp "]"
1945 <|> listCompr ns 1953 <|> listCompr ns
1946 <|> mkList ns `withRange` brackets (commaSep $ parseTerm ns PrecLam) 1954 <|> mkList ns `withRange` brackets (commaSep $ parseTerm ns PrecLam)
1947 <|> mkLeftSection `withRange` try{-todo: better try-} (parens $ (,) <$> siName (guardM (/= "-") operatorT) <*> parseTerm ns PrecLam) 1955 <|> mkLeftSection `withRange` try{-todo: better try-} (parens $ (,) <$> withSI (guardM (/= "-") operatorT) <*> parseTerm ns PrecLam)
1948 <|> mkRightSection `withRange` try{-todo: better try!-} (parens $ (,) <$> parseTerm ns PrecApp <*> siName operatorT) 1956 <|> mkRightSection `withRange` try{-todo: better try!-} (parens $ (,) <$> parseTerm ns PrecApp <*> withSI operatorT)
1949 <|> mkTuple ns `withRange` parens (commaSep $ parseTerm ns PrecLam) 1957 <|> mkTuple ns `withRange` parens (commaSep $ parseTerm ns PrecLam)
1950 <|> mkRecord `withRange` braces (commaSep $ ((,) <$> lowerCase ns <* colon <*> parseTerm ns PrecLam)) 1958 <|> mkRecord `withRange` braces (commaSep $ ((,) <$> lowerCase ns <* colon <*> parseTerm ns PrecLam))
1951 <|> do reserved "let" 1959 <|> do reserved "let"
@@ -2000,9 +2008,6 @@ mkList _ si xs = error "mkList"
2000mkNat (Namespace ExpLevel _) si n = SGlobal (noSI,"fromInt") `SAppV` sLit si (LInt $ fromIntegral n) 2008mkNat (Namespace ExpLevel _) si n = SGlobal (noSI,"fromInt") `SAppV` sLit si (LInt $ fromIntegral n)
2001mkNat _ _ n = toNat n 2009mkNat _ _ n = toNat n
2002 2010
2003siName :: P SName -> P SIName
2004siName = withSI
2005
2006withSI = withRange (,) 2011withSI = withRange (,)
2007 2012
2008mkIf si (b,t,f) = SGlobal (si,"primIfThenElse") `SAppV` b `SAppV` t `SAppV` f 2013mkIf si (b,t,f) = SGlobal (si,"primIfThenElse") `SAppV` b `SAppV` t `SAppV` f
@@ -2020,13 +2025,13 @@ manyNM n m p = do
2020 2025
2021generator, letdecl, boolExpression :: Namespace -> DBNames -> P (DBNames, SExp -> SExp) 2026generator, letdecl, boolExpression :: Namespace -> DBNames -> P (DBNames, SExp -> SExp)
2022generator ns dbs = do 2027generator ns dbs = do
2023 (dbs', pat) <- try $ pattern' ns dbs <* reservedOp "<-" 2028 (dbs', pat) <- try $ pattern' ns <* reservedOp "<-"
2024 exp <- dbf' dbs <$> parseTerm ns PrecLam 2029 exp <- dbf' dbs <$> parseTerm ns PrecLam
2025 ge <- ask 2030 ge <- ask
2026 return $ (,) dbs' $ \e -> application 2031 return $ (,) (dbs' <> dbs) $ \e -> application
2027 [ SGlobal (noSI, "concatMap") 2032 [ SGlobal (noSI, "concatMap")
2028 , SLamV $ compileGuardTree id id ge $ Alts 2033 , SLamV $ compileGuardTree id id ge $ Alts
2029 [ compilePatts [(pat, 0)] Nothing $ {-upS $ -} e 2034 [ compilePatts [(mapP (dbf' dbs) pat, 0)] Nothing $ {-upS $ -} e
2030 , GuardLeaf $ SGlobal (noSI, "Nil") 2035 , GuardLeaf $ SGlobal (noSI, "Nil")
2031 ] 2036 ]
2032 , exp 2037 , exp
@@ -2041,7 +2046,7 @@ boolExpression ns dbs = do
2041application = foldl1 SAppV 2046application = foldl1 SAppV
2042 2047
2043listCompr :: Namespace -> P SExp 2048listCompr :: Namespace -> P SExp
2044listCompr ns = (\e (dbs', fs) -> foldr ($) (dbf (diffDBNames dbs') e) fs) 2049listCompr ns = (\e (dbs', fs) -> foldr ($) (dbff (diffDBNames dbs') e) fs)
2045 <$> try' "List comprehension" ((SGlobal (noSI, "singleton") `SAppV`) <$ reservedOp "[" <*> parseTerm ns PrecLam <* reservedOp "|") 2050 <$> try' "List comprehension" ((SGlobal (noSI, "singleton") `SAppV`) <$ reservedOp "[" <*> parseTerm ns PrecLam <* reservedOp "|")
2046 <*> commaSepUnfold (liftA2 (<|>) (generator ns) $ liftA2 (<|>) (letdecl ns) (boolExpression ns)) mempty <* reservedOp "]" 2051 <*> commaSepUnfold (liftA2 (<|>) (generator ns) $ liftA2 (<|>) (letdecl ns) (boolExpression ns)) mempty <* reservedOp "]"
2047 2052
@@ -2049,11 +2054,11 @@ listCompr ns = (\e (dbs', fs) -> foldr ($) (dbf (diffDBNames dbs') e) fs)
2049diffDBNames' xs ys = take (length xs - length ys) xs 2054diffDBNames' xs ys = take (length xs - length ys) xs
2050 2055
2051dbf' = dbf_ 0 2056dbf' = dbf_ 0
2052dbf_ j (DBNamesC xs) e = foldl (\e (i, n) -> substSG n (\si -> SVar (si, n) i) e) e $ zip [j..] xs 2057dbf_ j (DBNamesC xs) e = foldl (\e (i, (si, n)) -> substSG n (\si -> SVar (si, n) i) e) e $ zip [j..] xs
2053 2058
2054dbf :: [String] -> SExp -> SExp 2059dbff :: [String] -> SExp -> SExp
2055dbf [] e = e 2060dbff [] e = e
2056dbf (n: ns) e = substSG0 n $ dbf ns e 2061dbff (n: ns) e = substSG0 n $ dbff ns e
2057 2062
2058-------------------------------------------------------------------------------- 2063--------------------------------------------------------------------------------
2059 2064
@@ -2145,7 +2150,7 @@ mkLets :: GlobalEnv' -> [Stmt]{-where block-} -> SExp{-main expression-} -> SExp
2145mkLets _ [] e = e 2150mkLets _ [] e = e
2146mkLets ge (Let n _ mt _ (downS 0 -> Just x): ds) e 2151mkLets ge (Let n _ mt _ (downS 0 -> Just x): ds) e
2147 = SLet (maybe id (flip SAnn . addForalls {-todo-}[] []) mt x) (substSG0 (snd n) $ mkLets ge ds e) 2152 = SLet (maybe id (flip SAnn . addForalls {-todo-}[] []) mt x) (substSG0 (snd n) $ mkLets ge ds e)
2148mkLets ge (ValueDef (ns, p) x: ds) e = patLam (debugSI "13") id ge p (dbf ns $ mkLets ge ds e) `SAppV` x -- (p = e; f) --> (\p -> f) e 2153mkLets ge (ValueDef (ns, p) x: ds) e = patLam (debugSI "13") id ge p (dbff (map snd ns) $ mkLets ge ds e) `SAppV` x -- (p = e; f) --> (\p -> f) e
2149mkLets _ (x: ds) e = error $ "mkLets: " ++ show x 2154mkLets _ (x: ds) e = error $ "mkLets: " ++ show x
2150 2155
2151patLam si f ge = patLam_ si f ge (Visible, Wildcard SType) 2156patLam si f ge = patLam_ si f ge (Visible, Wildcard SType)
@@ -2157,7 +2162,7 @@ parseSomeGuards ns f = do
2157 pos <- sourceColumn <$> getPosition <* reservedOp "|" 2162 pos <- sourceColumn <$> getPosition <* reservedOp "|"
2158 guard $ f pos 2163 guard $ f pos
2159 (e', f) <- 2164 (e', f) <-
2160 do (e', PCon (_, p) vs) <- try $ pattern' ns mempty <* reservedOp "<-" 2165 do (e', PCon (_, p) vs) <- try $ pattern' ns <* reservedOp "<-"
2161 x <- parseETerm ns PrecEq 2166 x <- parseETerm ns PrecEq
2162 return (e', \gs' gs -> GuardNode x p vs (Alts gs'): gs) 2167 return (e', \gs' gs -> GuardNode x p vs (Alts gs'): gs)
2163 <|> do x <- parseETerm ns PrecEq 2168 <|> do x <- parseETerm ns PrecEq
@@ -2263,6 +2268,19 @@ varP = \case
2263 ViewPat e pp -> varPP pp 2268 ViewPat e pp -> varPP pp
2264 PatType pp e -> varPP pp 2269 PatType pp e -> varPP pp
2265 2270
2271getPVars :: Pat -> DBNames
2272getPVars = DBNamesC . reverse . getPVars_
2273
2274getPPVars = DBNamesC . reverse . getPPVars_
2275
2276getPVars_ = \case
2277 PVar n -> [n]
2278 PCon _ pp -> foldMap getPPVars_ pp
2279 ViewPat e pp -> getPPVars_ pp
2280 PatType pp e -> getPPVars_ pp
2281
2282getPPVars_ = \case
2283 ParPat pp -> foldMap getPVars_ pp
2266 2284
2267alts (Alts xs) = concatMap alts xs 2285alts (Alts xs) = concatMap alts xs
2268alts x = [x] 2286alts x = [x]
diff --git a/testdata/Builtins.out b/testdata/Builtins.out
index f84e8d03..dca1e33e 100644
--- a/testdata/Builtins.out
+++ b/testdata/Builtins.out
@@ -6,6 +6,9 @@ testdata/Builtins.lc 13:6-13:9 Type
6testdata/Builtins.lc 13:12-13:16 'Nat 6testdata/Builtins.lc 13:12-13:16 'Nat
7testdata/Builtins.lc 13:24-13:27 Type 7testdata/Builtins.lc 13:24-13:27 Type
8testdata/Builtins.lc 13:19-13:23 'Nat->'Nat 8testdata/Builtins.lc 13:19-13:23 'Nat->'Nat
9testdata/Builtins.lc 13:6-13:23 Type
10testdata/Builtins.lc 13:19-13:23 Type
11testdata/Builtins.lc 13:19-13:23 'Nat
9testdata/Builtins.lc 15:6-15:10 Type->Type 12testdata/Builtins.lc 15:6-15:10 Type->Type
10testdata/Builtins.lc 15:6-15:10 Type 13testdata/Builtins.lc 15:6-15:10 Type
11testdata/Builtins.lc 15:15-15:18 {a} -> 'List a 14testdata/Builtins.lc 15:15-15:18 {a} -> 'List a
@@ -14,6 +17,10 @@ testdata/Builtins.lc 15:26-15:27 Type
14testdata/Builtins.lc 15:29-15:33 Type->Type 17testdata/Builtins.lc 15:29-15:33 Type->Type
15testdata/Builtins.lc 15:34-15:35 Type 18testdata/Builtins.lc 15:34-15:35 Type
16testdata/Builtins.lc 15:21-15:25 {a} -> a -> 'List a -> 'List a 19testdata/Builtins.lc 15:21-15:25 {a} -> a -> 'List a -> 'List a
20testdata/Builtins.lc 15:6-15:25 Type
21testdata/Builtins.lc 15:15-15:18 'List V1
22testdata/Builtins.lc 15:21-15:25 Type
23testdata/Builtins.lc 15:21-15:25 'List V4
17testdata/Builtins.lc 19:26-23:31 Type -> Type->Type 24testdata/Builtins.lc 19:26-23:31 Type -> Type->Type
18testdata/Builtins.lc 19:26-23:31 Type->Type 25testdata/Builtins.lc 19:26-23:31 Type->Type
19testdata/Builtins.lc 19:26-23:31 Type 26testdata/Builtins.lc 19:26-23:31 Type
@@ -100,6 +107,14 @@ testdata/Builtins.lc 35:29-35:35 Type
100testdata/Builtins.lc 35:29-35:33 Type -> 'Nat->Type 107testdata/Builtins.lc 35:29-35:33 Type -> 'Nat->Type
101testdata/Builtins.lc 35:34-35:35 Type 108testdata/Builtins.lc 35:34-35:35 Type
102testdata/Builtins.lc 35:3-35:5 {a} -> a -> a -> a -> a -> 'VecS a (Succ (Succ (Succ (Succ Zero)))) 109testdata/Builtins.lc 35:3-35:5 {a} -> a -> a -> a -> a -> 'VecS a (Succ (Succ (Succ (Succ Zero))))
110testdata/Builtins.lc 32:6-35:5 Type
111testdata/Builtins.lc 32:6-32:10 Type
112testdata/Builtins.lc 33:3-33:5 Type
113testdata/Builtins.lc 33:3-33:5 'VecS V3 (Succ (Succ Zero))
114testdata/Builtins.lc 34:3-34:5 Type
115testdata/Builtins.lc 34:3-34:5 'VecS V5 (Succ (Succ (Succ Zero)))
116testdata/Builtins.lc 35:3-35:5 Type
117testdata/Builtins.lc 35:3-35:5 'VecS V7 (Succ (Succ (Succ (Succ Zero))))
103testdata/Builtins.lc 37:23-37:26 Type 118testdata/Builtins.lc 37:23-37:26 Type
104testdata/Builtins.lc 37:47-37:55 'Nat -> Type->Type 119testdata/Builtins.lc 37:47-37:55 'Nat -> Type->Type
105testdata/Builtins.lc 37:47-37:55 Type->Type 120testdata/Builtins.lc 37:47-37:55 Type->Type
@@ -249,14 +264,26 @@ testdata/Builtins.lc 57:71-57:84 Type
249testdata/Builtins.lc 57:71-57:74 'Nat -> 'Nat -> Type->Type 264testdata/Builtins.lc 57:71-57:74 'Nat -> 'Nat -> Type->Type
250testdata/Builtins.lc 57:79-57:84 Type 265testdata/Builtins.lc 57:79-57:84 Type
251testdata/Builtins.lc 57:3-57:7 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'Mat (Succ (Succ (Succ (Succ Zero)))) (Succ (Succ (Succ (Succ Zero)))) 'Float 266testdata/Builtins.lc 57:3-57:7 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'Mat (Succ (Succ (Succ (Succ Zero)))) (Succ (Succ (Succ (Succ Zero)))) 'Float
252testdata/Builtins.lc 49:49-57:84 Type 267testdata/Builtins.lc 48:6-48:9 Type
253testdata/Builtins.lc 50:49-57:84 Type 268testdata/Builtins.lc 48:6-57:84 Type
254testdata/Builtins.lc 51:49-57:84 Type 269testdata/Builtins.lc 49:3-49:54 Type
255testdata/Builtins.lc 52:64-57:84 Type 270testdata/Builtins.lc 49:3-49:7 'Mat (Succ (Succ Zero)) (Succ (Succ Zero)) 'Float
256testdata/Builtins.lc 53:64-57:84 Type 271testdata/Builtins.lc 50:3-50:54 Type
257testdata/Builtins.lc 54:64-57:84 Type 272testdata/Builtins.lc 50:3-50:7 'Mat (Succ (Succ (Succ Zero))) (Succ (Succ Zero)) 'Float
258testdata/Builtins.lc 55:79-57:84 Type 273testdata/Builtins.lc 51:3-51:54 Type
259testdata/Builtins.lc 56:79-57:84 Type 274testdata/Builtins.lc 51:3-51:7 'Mat (Succ (Succ (Succ (Succ Zero)))) (Succ (Succ Zero)) 'Float
275testdata/Builtins.lc 52:3-52:69 Type
276testdata/Builtins.lc 52:3-52:7 'Mat (Succ (Succ Zero)) (Succ (Succ (Succ Zero))) 'Float
277testdata/Builtins.lc 53:3-53:69 Type
278testdata/Builtins.lc 53:3-53:7 'Mat (Succ (Succ (Succ Zero))) (Succ (Succ (Succ Zero))) 'Float
279testdata/Builtins.lc 54:3-54:69 Type
280testdata/Builtins.lc 54:3-54:7 'Mat (Succ (Succ (Succ (Succ Zero)))) (Succ (Succ (Succ Zero))) 'Float
281testdata/Builtins.lc 55:3-55:84 Type
282testdata/Builtins.lc 55:3-55:7 'Mat (Succ (Succ Zero)) (Succ (Succ (Succ (Succ Zero)))) 'Float
283testdata/Builtins.lc 56:3-56:84 Type
284testdata/Builtins.lc 56:3-56:7 'Mat (Succ (Succ (Succ Zero))) (Succ (Succ (Succ (Succ Zero)))) 'Float
285testdata/Builtins.lc 57:3-57:84 Type
286testdata/Builtins.lc 57:3-57:7 'Mat (Succ (Succ (Succ (Succ Zero)))) (Succ (Succ (Succ (Succ Zero)))) 'Float
260testdata/Builtins.lc 60:22-64:37 Type->Type 287testdata/Builtins.lc 60:22-64:37 Type->Type
261testdata/Builtins.lc 60:22-64:37 Type 288testdata/Builtins.lc 60:22-64:37 Type
262testdata/Builtins.lc 60:30-60:35 Type 289testdata/Builtins.lc 60:30-60:35 Type
@@ -284,6 +311,7 @@ testdata/Builtins.lc 68:14-68:16 'Swizz
284testdata/Builtins.lc 68:19-68:21 'Swizz 311testdata/Builtins.lc 68:19-68:21 'Swizz
285testdata/Builtins.lc 68:24-68:26 'Swizz 312testdata/Builtins.lc 68:24-68:26 'Swizz
286testdata/Builtins.lc 68:29-68:31 'Swizz 313testdata/Builtins.lc 68:29-68:31 'Swizz
314testdata/Builtins.lc 68:6-68:31 Type
287testdata/Builtins.lc 71:27-71:56 Type 315testdata/Builtins.lc 71:27-71:56 Type
288testdata/Builtins.lc 71:27-71:28 V5 316testdata/Builtins.lc 71:27-71:28 V5
289testdata/Builtins.lc 71:32-71:33 Type 317testdata/Builtins.lc 71:32-71:33 Type
@@ -898,12 +926,14 @@ testdata/Builtins.lc 202:7-202:28 'BlendingFactor
898testdata/Builtins.lc 203:7-203:20 'BlendingFactor 926testdata/Builtins.lc 203:7-203:20 'BlendingFactor
899testdata/Builtins.lc 204:7-204:28 'BlendingFactor 927testdata/Builtins.lc 204:7-204:28 'BlendingFactor
900testdata/Builtins.lc 205:7-205:23 'BlendingFactor 928testdata/Builtins.lc 205:7-205:23 'BlendingFactor
929testdata/Builtins.lc 190:6-205:23 Type
901testdata/Builtins.lc 207:6-207:19 Type 930testdata/Builtins.lc 207:6-207:19 Type
902testdata/Builtins.lc 208:7-208:14 'BlendEquation 931testdata/Builtins.lc 208:7-208:14 'BlendEquation
903testdata/Builtins.lc 209:7-209:19 'BlendEquation 932testdata/Builtins.lc 209:7-209:19 'BlendEquation
904testdata/Builtins.lc 210:7-210:26 'BlendEquation 933testdata/Builtins.lc 210:7-210:26 'BlendEquation
905testdata/Builtins.lc 211:7-211:10 'BlendEquation 934testdata/Builtins.lc 211:7-211:10 'BlendEquation
906testdata/Builtins.lc 212:7-212:10 'BlendEquation 935testdata/Builtins.lc 212:7-212:10 'BlendEquation
936testdata/Builtins.lc 207:6-212:10 Type
907testdata/Builtins.lc 214:6-214:20 Type 937testdata/Builtins.lc 214:6-214:20 Type
908testdata/Builtins.lc 215:7-215:12 'LogicOperation 938testdata/Builtins.lc 215:7-215:12 'LogicOperation
909testdata/Builtins.lc 216:7-216:10 'LogicOperation 939testdata/Builtins.lc 216:7-216:10 'LogicOperation
@@ -921,6 +951,7 @@ testdata/Builtins.lc 227:7-227:19 'LogicOperation
921testdata/Builtins.lc 228:7-228:17 'LogicOperation 951testdata/Builtins.lc 228:7-228:17 'LogicOperation
922testdata/Builtins.lc 229:7-229:11 'LogicOperation 952testdata/Builtins.lc 229:7-229:11 'LogicOperation
923testdata/Builtins.lc 230:7-230:10 'LogicOperation 953testdata/Builtins.lc 230:7-230:10 'LogicOperation
954testdata/Builtins.lc 214:6-230:10 Type
924testdata/Builtins.lc 232:6-232:22 Type 955testdata/Builtins.lc 232:6-232:22 Type
925testdata/Builtins.lc 233:7-233:13 'StencilOperation 956testdata/Builtins.lc 233:7-233:13 'StencilOperation
926testdata/Builtins.lc 234:7-234:13 'StencilOperation 957testdata/Builtins.lc 234:7-234:13 'StencilOperation
@@ -930,6 +961,7 @@ testdata/Builtins.lc 237:7-237:17 'StencilOperation
930testdata/Builtins.lc 238:7-238:13 'StencilOperation 961testdata/Builtins.lc 238:7-238:13 'StencilOperation
931testdata/Builtins.lc 239:7-239:17 'StencilOperation 962testdata/Builtins.lc 239:7-239:17 'StencilOperation
932testdata/Builtins.lc 240:7-240:15 'StencilOperation 963testdata/Builtins.lc 240:7-240:15 'StencilOperation
964testdata/Builtins.lc 232:6-240:15 Type
933testdata/Builtins.lc 242:6-242:24 Type 965testdata/Builtins.lc 242:6-242:24 Type
934testdata/Builtins.lc 243:7-243:12 'ComparisonFunction 966testdata/Builtins.lc 243:7-243:12 'ComparisonFunction
935testdata/Builtins.lc 244:7-244:11 'ComparisonFunction 967testdata/Builtins.lc 244:7-244:11 'ComparisonFunction
@@ -939,41 +971,60 @@ testdata/Builtins.lc 247:7-247:14 'ComparisonFunction
939testdata/Builtins.lc 248:7-248:15 'ComparisonFunction 971testdata/Builtins.lc 248:7-248:15 'ComparisonFunction
940testdata/Builtins.lc 249:7-249:13 'ComparisonFunction 972testdata/Builtins.lc 249:7-249:13 'ComparisonFunction
941testdata/Builtins.lc 250:7-250:13 'ComparisonFunction 973testdata/Builtins.lc 250:7-250:13 'ComparisonFunction
974testdata/Builtins.lc 242:6-250:13 Type
942testdata/Builtins.lc 252:6-252:21 Type 975testdata/Builtins.lc 252:6-252:21 Type
943testdata/Builtins.lc 253:7-253:17 'ProvokingVertex 976testdata/Builtins.lc 253:7-253:17 'ProvokingVertex
944testdata/Builtins.lc 254:7-254:18 'ProvokingVertex 977testdata/Builtins.lc 254:7-254:18 'ProvokingVertex
978testdata/Builtins.lc 252:6-254:18 Type
945testdata/Builtins.lc 256:6-256:14 Type 979testdata/Builtins.lc 256:6-256:14 Type
946testdata/Builtins.lc 257:7-257:16 'CullMode 980testdata/Builtins.lc 257:7-257:16 'CullMode
947testdata/Builtins.lc 258:7-258:15 'CullMode 981testdata/Builtins.lc 258:7-258:15 'CullMode
948testdata/Builtins.lc 259:7-259:15 'CullMode 982testdata/Builtins.lc 259:7-259:15 'CullMode
983testdata/Builtins.lc 256:6-259:15 Type
949testdata/Builtins.lc 261:6-261:15 Type 984testdata/Builtins.lc 261:6-261:15 Type
950testdata/Builtins.lc 262:17-262:22 Type 985testdata/Builtins.lc 262:17-262:22 Type
951testdata/Builtins.lc 262:7-262:16 'Float->'PointSize 986testdata/Builtins.lc 262:7-262:16 'Float->'PointSize
952testdata/Builtins.lc 263:7-263:23 'PointSize 987testdata/Builtins.lc 263:7-263:23 'PointSize
988testdata/Builtins.lc 261:6-263:23 Type
989testdata/Builtins.lc 262:7-262:16 Type
990testdata/Builtins.lc 262:7-262:16 'PointSize
953testdata/Builtins.lc 265:6-265:17 Type 991testdata/Builtins.lc 265:6-265:17 Type
954testdata/Builtins.lc 266:7-266:18 'PolygonMode 992testdata/Builtins.lc 266:7-266:18 'PolygonMode
955testdata/Builtins.lc 267:20-267:29 Type 993testdata/Builtins.lc 267:20-267:29 Type
956testdata/Builtins.lc 267:7-267:19 'PointSize->'PolygonMode 994testdata/Builtins.lc 267:7-267:19 'PointSize->'PolygonMode
957testdata/Builtins.lc 268:19-268:24 Type 995testdata/Builtins.lc 268:19-268:24 Type
958testdata/Builtins.lc 268:7-268:18 'Float->'PolygonMode 996testdata/Builtins.lc 268:7-268:18 'Float->'PolygonMode
997testdata/Builtins.lc 265:6-268:18 Type
998testdata/Builtins.lc 267:7-267:19 Type
999testdata/Builtins.lc 267:7-267:19 'PolygonMode
1000testdata/Builtins.lc 268:7-268:18 Type
1001testdata/Builtins.lc 268:7-268:18 'PolygonMode
959testdata/Builtins.lc 270:6-270:19 Type 1002testdata/Builtins.lc 270:6-270:19 Type
960testdata/Builtins.lc 271:7-271:15 'PolygonOffset 1003testdata/Builtins.lc 271:7-271:15 'PolygonOffset
961testdata/Builtins.lc 272:14-272:19 Type 1004testdata/Builtins.lc 272:14-272:19 Type
962testdata/Builtins.lc 270:6-272:25 Type 1005testdata/Builtins.lc 270:6-272:25 Type
963testdata/Builtins.lc 272:20-272:25 Type 1006testdata/Builtins.lc 272:20-272:25 Type
964testdata/Builtins.lc 272:7-272:13 'Float -> 'Float->'PolygonOffset 1007testdata/Builtins.lc 272:7-272:13 'Float -> 'Float->'PolygonOffset
1008testdata/Builtins.lc 270:6-272:13 Type
1009testdata/Builtins.lc 272:7-272:13 Type
1010testdata/Builtins.lc 272:7-272:13 'PolygonOffset
965testdata/Builtins.lc 274:6-274:28 Type 1011testdata/Builtins.lc 274:6-274:28 Type
966testdata/Builtins.lc 275:7-275:16 'PointSpriteCoordOrigin 1012testdata/Builtins.lc 275:7-275:16 'PointSpriteCoordOrigin
967testdata/Builtins.lc 276:7-276:16 'PointSpriteCoordOrigin 1013testdata/Builtins.lc 276:7-276:16 'PointSpriteCoordOrigin
1014testdata/Builtins.lc 274:6-276:16 Type
968testdata/Builtins.lc 279:6-279:11 Type->Type 1015testdata/Builtins.lc 279:6-279:11 Type->Type
1016testdata/Builtins.lc 279:6-279:11 Type
969testdata/Builtins.lc 280:6-280:13 Type->Type 1017testdata/Builtins.lc 280:6-280:13 Type->Type
1018testdata/Builtins.lc 280:6-280:13 Type
970testdata/Builtins.lc 281:6-281:11 Type->Type 1019testdata/Builtins.lc 281:6-281:11 Type->Type
1020testdata/Builtins.lc 281:6-281:11 Type
971testdata/Builtins.lc 283:6-283:19 Type 1021testdata/Builtins.lc 283:6-283:19 Type
972testdata/Builtins.lc 284:7-284:15 'PrimitiveType 1022testdata/Builtins.lc 284:7-284:15 'PrimitiveType
973testdata/Builtins.lc 285:7-285:11 'PrimitiveType 1023testdata/Builtins.lc 285:7-285:11 'PrimitiveType
974testdata/Builtins.lc 286:7-286:12 'PrimitiveType 1024testdata/Builtins.lc 286:7-286:12 'PrimitiveType
975testdata/Builtins.lc 287:7-287:24 'PrimitiveType 1025testdata/Builtins.lc 287:7-287:24 'PrimitiveType
976testdata/Builtins.lc 288:7-288:20 'PrimitiveType 1026testdata/Builtins.lc 288:7-288:20 'PrimitiveType
1027testdata/Builtins.lc 283:6-288:20 Type
977testdata/Builtins.lc 291:16-291:18 Type 1028testdata/Builtins.lc 291:16-291:18 Type
978testdata/Builtins.lc 291:22-291:48 Type 1029testdata/Builtins.lc 291:22-291:48 Type
979testdata/Builtins.lc 291:22-291:25 'Nat -> Type->Type 1030testdata/Builtins.lc 291:22-291:25 'Nat -> Type->Type
@@ -1022,11 +1073,14 @@ testdata/Builtins.lc 300:89-300:107 Type
1022testdata/Builtins.lc 300:89-300:102 'PrimitiveType->Type 1073testdata/Builtins.lc 300:89-300:102 'PrimitiveType->Type
1023testdata/Builtins.lc 300:103-300:107 'PrimitiveType 1074testdata/Builtins.lc 300:103-300:107 'PrimitiveType
1024testdata/Builtins.lc 300:3-300:10 'Float -> 'ProvokingVertex -> 'RasterContext Line 1075testdata/Builtins.lc 300:3-300:10 'Float -> 'ProvokingVertex -> 'RasterContext Line
1025testdata/Builtins.lc 298:103-300:107 Type 1076testdata/Builtins.lc 297:6-297:19 Type
1026testdata/Builtins.lc 298:103-298:111 Type 1077testdata/Builtins.lc 297:6-300:107 Type
1027testdata/Builtins.lc 299:103-300:107 Type 1078testdata/Builtins.lc 298:3-298:111 Type
1028testdata/Builtins.lc 299:103-299:108 Type 1079testdata/Builtins.lc 298:3-298:14 'RasterContext Triangle
1029testdata/Builtins.lc 300:103-300:107 Type 1080testdata/Builtins.lc 299:3-299:108 Type
1081testdata/Builtins.lc 299:3-299:11 'RasterContext Point
1082testdata/Builtins.lc 300:3-300:107 Type
1083testdata/Builtins.lc 300:3-300:10 'RasterContext Line
1030testdata/Builtins.lc 302:6-302:18 Type->Type 1084testdata/Builtins.lc 302:6-302:18 Type->Type
1031testdata/Builtins.lc 304:27-304:56 Type 1085testdata/Builtins.lc 304:27-304:56 Type
1032testdata/Builtins.lc 304:27-304:35 Type->Type 1086testdata/Builtins.lc 304:27-304:35 Type->Type
@@ -1040,6 +1094,13 @@ testdata/Builtins.lc 305:42-305:56 Type
1040testdata/Builtins.lc 305:42-305:54 Type->Type 1094testdata/Builtins.lc 305:42-305:54 Type->Type
1041testdata/Builtins.lc 305:55-305:56 Type 1095testdata/Builtins.lc 305:55-305:56 Type
1042testdata/Builtins.lc 305:3-305:7 {a} -> 'Interpolated a 1096testdata/Builtins.lc 305:3-305:7 {a} -> 'Interpolated a
1097testdata/Builtins.lc 302:6-305:7 Type
1098testdata/Builtins.lc 303:3-303:9 Type
1099testdata/Builtins.lc 303:3-303:9 'Interpolated V2
1100testdata/Builtins.lc 303:11-303:24 Type
1101testdata/Builtins.lc 303:11-303:24 'Interpolated V3
1102testdata/Builtins.lc 305:3-305:7 'Interpolated V3
1103testdata/Builtins.lc 302:6-302:18 Type
1043testdata/Builtins.lc 309:14-310:32 Type->Type 1104testdata/Builtins.lc 309:14-310:32 Type->Type
1044testdata/Builtins.lc 309:14-310:32 Type 1105testdata/Builtins.lc 309:14-310:32 Type
1045testdata/Builtins.lc 309:19-309:20 Type->Type 1106testdata/Builtins.lc 309:19-309:20 Type->Type
@@ -1115,8 +1176,14 @@ testdata/Builtins.lc 323:60-323:74 Type
1115testdata/Builtins.lc 323:60-323:68 Type->Type 1176testdata/Builtins.lc 323:60-323:68 Type->Type
1116testdata/Builtins.lc 323:69-323:74 Type 1177testdata/Builtins.lc 323:69-323:74 Type
1117testdata/Builtins.lc 321:3-321:8 'Tuple2 'BlendEquation 'BlendEquation -> 'Tuple2 ('Tuple2 'BlendingFactor 'BlendingFactor) ('Tuple2 'BlendingFactor 'BlendingFactor) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'Blending 'Float 1178testdata/Builtins.lc 321:3-321:8 'Tuple2 'BlendEquation 'BlendEquation -> 'Tuple2 ('Tuple2 'BlendingFactor 'BlendingFactor) ('Tuple2 'BlendingFactor 'BlendingFactor) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'Blending 'Float
1118testdata/Builtins.lc 319:69-323:74 Type 1179testdata/Builtins.lc 318:6-318:14 Type
1119testdata/Builtins.lc 320:69-323:74 Type 1180testdata/Builtins.lc 318:6-323:74 Type
1181testdata/Builtins.lc 319:3-319:70 Type
1182testdata/Builtins.lc 319:3-319:13 'Blending V0
1183testdata/Builtins.lc 320:3-320:70 Type
1184testdata/Builtins.lc 320:3-320:15 'Blending V2
1185testdata/Builtins.lc 321:3-323:74 Type
1186testdata/Builtins.lc 321:3-321:8 'Blending 'Float
1120testdata/Builtins.lc 330:6-330:18 Type 1187testdata/Builtins.lc 330:6-330:18 Type
1121testdata/Builtins.lc 331:6-331:16 Type 1188testdata/Builtins.lc 331:6-331:16 Type
1122testdata/Builtins.lc 332:6-332:11 Type 1189testdata/Builtins.lc 332:6-332:11 Type
@@ -1173,8 +1240,14 @@ testdata/Builtins.lc 338:90-338:103 Type
1173testdata/Builtins.lc 338:90-338:97 Type->Type 1240testdata/Builtins.lc 338:90-338:97 Type->Type
1174testdata/Builtins.lc 338:98-338:103 Type 1241testdata/Builtins.lc 338:98-338:103 Type
1175testdata/Builtins.lc 338:3-338:12 'StencilTests -> 'StencilOps -> 'StencilOps -> 'FragmentOperation ('Stencil 'Int32) 1242testdata/Builtins.lc 338:3-338:12 'StencilTests -> 'StencilOps -> 'StencilOps -> 'FragmentOperation ('Stencil 'Int32)
1176testdata/Builtins.lc 336:90-338:103 Type 1243testdata/Builtins.lc 334:6-334:23 Type
1177testdata/Builtins.lc 337:90-338:103 Type 1244testdata/Builtins.lc 334:6-338:103 Type
1245testdata/Builtins.lc 335:3-336:101 Type
1246testdata/Builtins.lc 335:3-335:10 'FragmentOperation ('Color V6)
1247testdata/Builtins.lc 337:3-337:101 Type
1248testdata/Builtins.lc 337:3-337:10 'FragmentOperation ('Depth 'Float)
1249testdata/Builtins.lc 338:3-338:103 Type
1250testdata/Builtins.lc 338:3-338:12 'FragmentOperation ('Stencil 'Int32)
1178testdata/Builtins.lc 341:32-345:146 Type->Type 1251testdata/Builtins.lc 341:32-345:146 Type->Type
1179testdata/Builtins.lc 341:32-345:146 Type 1252testdata/Builtins.lc 341:32-345:146 Type
1180testdata/Builtins.lc 341:37-341:38 Type->Type 1253testdata/Builtins.lc 341:37-341:38 Type->Type
@@ -1295,6 +1368,7 @@ testdata/Builtins.lc 352:19-352:36 Type->Type
1295testdata/Builtins.lc 352:37-352:38 Type 1368testdata/Builtins.lc 352:37-352:38 Type
1296testdata/Builtins.lc 348:5-348:13 Type->Type 1369testdata/Builtins.lc 348:5-348:13 Type->Type
1297testdata/Builtins.lc 354:6-354:12 Type->Type 1370testdata/Builtins.lc 354:6-354:12 Type->Type
1371testdata/Builtins.lc 354:6-354:12 Type
1298testdata/Builtins.lc 356:15-356:46 Type 1372testdata/Builtins.lc 356:15-356:46 Type
1299testdata/Builtins.lc 356:15-356:16 V3 1373testdata/Builtins.lc 356:15-356:16 V3
1300testdata/Builtins.lc 356:20-356:21 Type 1374testdata/Builtins.lc 356:20-356:21 Type
@@ -1331,6 +1405,7 @@ testdata/Builtins.lc 358:51-358:52 Type
1331testdata/Builtins.lc 358:1-358:13 {a} -> a->'Bool -> 'Stream a -> 'Stream a 1405testdata/Builtins.lc 358:1-358:13 {a} -> a->'Bool -> 'Stream a -> 'Stream a
1332testdata/Builtins.lc 360:22-360:35 Type 1406testdata/Builtins.lc 360:22-360:35 Type
1333testdata/Builtins.lc 360:6-360:15 'PrimitiveType -> Type->Type 1407testdata/Builtins.lc 360:6-360:15 'PrimitiveType -> Type->Type
1408testdata/Builtins.lc 360:6-360:15 Type
1334testdata/Builtins.lc 362:28-362:34 Type->Type 1409testdata/Builtins.lc 362:28-362:34 Type->Type
1335testdata/Builtins.lc 362:36-362:49 Type 1410testdata/Builtins.lc 362:36-362:49 Type
1336testdata/Builtins.lc 362:36-362:45 'PrimitiveType -> Type->Type 1411testdata/Builtins.lc 362:36-362:45 'PrimitiveType -> Type->Type
@@ -1512,6 +1587,7 @@ testdata/Builtins.lc 389:25-389:37 Type
1512testdata/Builtins.lc 389:25-389:29 Type 1587testdata/Builtins.lc 389:25-389:29 Type
1513testdata/Builtins.lc 389:33-389:37 Type 1588testdata/Builtins.lc 389:33-389:37 Type
1514testdata/Builtins.lc 389:6-389:14 'Nat -> Type->Type 1589testdata/Builtins.lc 389:6-389:14 'Nat -> Type->Type
1590testdata/Builtins.lc 389:6-389:14 Type
1515testdata/Builtins.lc 391:27-391:33 Type->Type 1591testdata/Builtins.lc 391:27-391:33 Type->Type
1516testdata/Builtins.lc 391:35-391:47 Type 1592testdata/Builtins.lc 391:35-391:47 Type
1517testdata/Builtins.lc 391:35-391:43 'Nat -> Type->Type 1593testdata/Builtins.lc 391:35-391:43 'Nat -> Type->Type
@@ -1719,6 +1795,12 @@ testdata/Builtins.lc 433:102-433:113 'Nat -> Type->Type
1719testdata/Builtins.lc 433:114-433:115 'Nat 1795testdata/Builtins.lc 433:114-433:115 'Nat
1720testdata/Builtins.lc 433:116-433:117 Type 1796testdata/Builtins.lc 433:116-433:117 Type
1721testdata/Builtins.lc 433:3-433:14 {a:'Nat} -> {b} -> {c} -> {d : 'SameLayerCounts c} -> {e : 'FrameBuffer a b ~ 'TFFrameBuffer c} -> c -> 'FrameBuffer a b 1797testdata/Builtins.lc 433:3-433:14 {a:'Nat} -> {b} -> {c} -> {d : 'SameLayerCounts c} -> {e : 'FrameBuffer a b ~ 'TFFrameBuffer c} -> c -> 'FrameBuffer a b
1798testdata/Builtins.lc 431:6-433:14 Type
1799testdata/Builtins.lc 432:3-432:13 Type
1800testdata/Builtins.lc 432:3-432:13 'FrameBuffer V5 V4
1801testdata/Builtins.lc 433:3-433:14 Type
1802testdata/Builtins.lc 433:3-433:14 'FrameBuffer V7 V6
1803testdata/Builtins.lc 431:6-431:17 Type
1722testdata/Builtins.lc 435:34-435:44 {a:'Nat} -> {b} -> 'FragOps' b -> 'Stream ('Fragment a ('RemSemantics b)) -> 'FrameBuffer a b -> 'FrameBuffer a b 1804testdata/Builtins.lc 435:34-435:44 {a:'Nat} -> {b} -> 'FragOps' b -> 'Stream ('Fragment a ('RemSemantics b)) -> 'FrameBuffer a b -> 'FrameBuffer a b
1723testdata/Builtins.lc 435:45-435:48 'FragOps' V0 1805testdata/Builtins.lc 435:45-435:48 'FragOps' V0
1724testdata/Builtins.lc 435:45-435:48 V9 1806testdata/Builtins.lc 435:45-435:48 V9
@@ -1807,13 +1889,18 @@ testdata/Builtins.lc 447:94-447:105 Type
1807testdata/Builtins.lc 447:94-447:97 'Nat -> Type->Type 1889testdata/Builtins.lc 447:94-447:97 'Nat -> Type->Type
1808testdata/Builtins.lc 447:100-447:105 Type 1890testdata/Builtins.lc 447:100-447:105 Type
1809testdata/Builtins.lc 447:3-447:16 'FrameBuffer (Succ Zero) ('Tuple2 ('Depth 'Float) ('Color ('VecS 'Float (Succ (Succ (Succ (Succ Zero))))))) -> 'Image (Succ Zero) ('Color ('VecS 'Float (Succ (Succ (Succ (Succ Zero)))))) 1891testdata/Builtins.lc 447:3-447:16 'FrameBuffer (Succ Zero) ('Tuple2 ('Depth 'Float) ('Color ('VecS 'Float (Succ (Succ (Succ (Succ Zero))))))) -> 'Image (Succ Zero) ('Color ('VecS 'Float (Succ (Succ (Succ (Succ Zero))))))
1810testdata/Builtins.lc 441:42-447:105 Type 1892testdata/Builtins.lc 439:6-439:11 Type
1811testdata/Builtins.lc 441:42-441:56 Type 1893testdata/Builtins.lc 439:6-447:105 Type
1812testdata/Builtins.lc 442:53-447:105 Type 1894testdata/Builtins.lc 440:3-441:56 Type
1813testdata/Builtins.lc 442:53-442:67 Type 1895testdata/Builtins.lc 440:3-440:13 'Image V6 ('Color V3)
1814testdata/Builtins.lc 443:53-447:105 Type 1896testdata/Builtins.lc 442:3-442:67 Type
1815testdata/Builtins.lc 443:53-443:67 Type 1897testdata/Builtins.lc 442:3-442:13 'Image V1 ('Depth 'Float)
1816testdata/Builtins.lc 446:53-447:105 Type 1898testdata/Builtins.lc 443:3-443:67 Type
1899testdata/Builtins.lc 443:3-443:15 'Image V1 ('Stencil 'Int)
1900testdata/Builtins.lc 446:3-446:54 Type
1901testdata/Builtins.lc 446:3-446:11 'Image (Succ Zero) V1
1902testdata/Builtins.lc 447:3-447:105 Type
1903testdata/Builtins.lc 447:3-447:16 'Image (Succ Zero) ('Color ('VecS 'Float (Succ (Succ (Succ (Succ Zero))))))
1817testdata/Builtins.lc 449:6-449:12 Type 1904testdata/Builtins.lc 449:6-449:12 Type
1818testdata/Builtins.lc 450:26-450:51 Type 1905testdata/Builtins.lc 450:26-450:51 Type
1819testdata/Builtins.lc 450:26-450:37 'Nat -> Type->Type 1906testdata/Builtins.lc 450:26-450:37 'Nat -> Type->Type
@@ -1823,6 +1910,9 @@ testdata/Builtins.lc 450:40-450:41 Type
1823testdata/Builtins.lc 450:40-450:41 V1 1910testdata/Builtins.lc 450:40-450:41 V1
1824testdata/Builtins.lc 450:45-450:51 Type 1911testdata/Builtins.lc 450:45-450:51 Type
1825testdata/Builtins.lc 450:3-450:12 {a:'Nat} -> {b} -> 'FrameBuffer a b -> 'Output 1912testdata/Builtins.lc 450:3-450:12 {a:'Nat} -> {b} -> 'FrameBuffer a b -> 'Output
1913testdata/Builtins.lc 449:6-450:12 Type
1914testdata/Builtins.lc 450:3-450:12 Type
1915testdata/Builtins.lc 450:3-450:12 'Output
1826testdata/Builtins.lc 456:34-456:73 Type 1916testdata/Builtins.lc 456:34-456:73 Type
1827testdata/Builtins.lc 456:34-456:37 Type->Type 1917testdata/Builtins.lc 456:34-456:37 Type->Type
1828testdata/Builtins.lc 456:39-456:57 Type 1918testdata/Builtins.lc 456:39-456:57 Type
@@ -2675,19 +2765,29 @@ testdata/Builtins.lc 546:36-546:39 'Nat -> Type->Type
2675testdata/Builtins.lc 546:42-546:47 Type 2765testdata/Builtins.lc 546:42-546:47 Type
2676testdata/Builtins.lc 547:20-547:27 Type 2766testdata/Builtins.lc 547:20-547:27 Type
2677testdata/Builtins.lc 545:3-545:12 'VecS 'Int (Succ (Succ Zero)) -> 'Image (Succ Zero) ('Color ('VecS 'Float (Succ (Succ (Succ (Succ Zero)))))) -> 'Texture 2767testdata/Builtins.lc 545:3-545:12 'VecS 'Int (Succ (Succ Zero)) -> 'Image (Succ Zero) ('Color ('VecS 'Float (Succ (Succ (Succ (Succ Zero)))))) -> 'Texture
2768testdata/Builtins.lc 541:6-545:12 Type
2769testdata/Builtins.lc 542:3-542:16 Type
2770testdata/Builtins.lc 542:3-542:16 'Texture
2771testdata/Builtins.lc 545:3-545:12 Type
2772testdata/Builtins.lc 545:3-545:12 'Texture
2678testdata/Builtins.lc 549:6-549:12 Type 2773testdata/Builtins.lc 549:6-549:12 Type
2679testdata/Builtins.lc 550:5-550:16 'Filter 2774testdata/Builtins.lc 550:5-550:16 'Filter
2680testdata/Builtins.lc 551:5-551:17 'Filter 2775testdata/Builtins.lc 551:5-551:17 'Filter
2776testdata/Builtins.lc 549:6-551:17 Type
2681testdata/Builtins.lc 553:6-553:14 Type 2777testdata/Builtins.lc 553:6-553:14 Type
2682testdata/Builtins.lc 554:5-554:11 'EdgeMode 2778testdata/Builtins.lc 554:5-554:11 'EdgeMode
2683testdata/Builtins.lc 555:5-555:19 'EdgeMode 2779testdata/Builtins.lc 555:5-555:19 'EdgeMode
2684testdata/Builtins.lc 556:5-556:16 'EdgeMode 2780testdata/Builtins.lc 556:5-556:16 'EdgeMode
2781testdata/Builtins.lc 553:6-556:16 Type
2685testdata/Builtins.lc 558:6-558:13 Type 2782testdata/Builtins.lc 558:6-558:13 Type
2686testdata/Builtins.lc 558:24-558:30 Type 2783testdata/Builtins.lc 558:24-558:30 Type
2687testdata/Builtins.lc 558:6-558:47 Type 2784testdata/Builtins.lc 558:6-558:47 Type
2688testdata/Builtins.lc 558:31-558:39 Type 2785testdata/Builtins.lc 558:31-558:39 Type
2689testdata/Builtins.lc 558:40-558:47 Type 2786testdata/Builtins.lc 558:40-558:47 Type
2690testdata/Builtins.lc 558:16-558:23 'Filter -> 'EdgeMode -> 'Texture->'Sampler 2787testdata/Builtins.lc 558:16-558:23 'Filter -> 'EdgeMode -> 'Texture->'Sampler
2788testdata/Builtins.lc 558:6-558:23 Type
2789testdata/Builtins.lc 558:16-558:23 Type
2790testdata/Builtins.lc 558:16-558:23 'Sampler
2691testdata/Builtins.lc 561:14-561:21 Type 2791testdata/Builtins.lc 561:14-561:21 Type
2692testdata/Builtins.lc 561:25-561:51 Type 2792testdata/Builtins.lc 561:25-561:51 Type
2693testdata/Builtins.lc 561:25-561:28 'Nat -> Type->Type 2793testdata/Builtins.lc 561:25-561:28 'Nat -> Type->Type
diff --git a/testdata/Internals.out b/testdata/Internals.out
index 06279002..d879bffd 100644
--- a/testdata/Internals.out
+++ b/testdata/Internals.out
@@ -11,22 +11,31 @@ testdata/Internals.lc 7:45-7:46 Type
11testdata/Internals.lc 7:1-7:8 {a} -> a->a -> a 11testdata/Internals.lc 7:1-7:8 {a} -> a->a -> a
12testdata/Internals.lc 9:6-9:10 Type 12testdata/Internals.lc 9:6-9:10 Type
13testdata/Internals.lc 9:13-9:15 'Unit 13testdata/Internals.lc 9:13-9:15 'Unit
14testdata/Internals.lc 9:6-9:15 Type
14testdata/Internals.lc 10:6-10:12 Type 15testdata/Internals.lc 10:6-10:12 Type
15testdata/Internals.lc 11:18-11:24 Type 16testdata/Internals.lc 11:18-11:24 Type
16testdata/Internals.lc 11:6-11:11 'String->Type 17testdata/Internals.lc 11:6-11:11 'String->Type
18testdata/Internals.lc 11:6-11:11 Type
17testdata/Internals.lc 14:6-14:12 Type 19testdata/Internals.lc 14:6-14:12 Type
18testdata/Internals.lc 14:15-14:21 'Tuple0 20testdata/Internals.lc 14:15-14:21 'Tuple0
21testdata/Internals.lc 14:6-14:21 Type
19testdata/Internals.lc 15:6-15:12 Type->Type 22testdata/Internals.lc 15:6-15:12 Type->Type
20testdata/Internals.lc 15:6-15:25 Type 23testdata/Internals.lc 15:6-15:25 Type
21testdata/Internals.lc 15:24-15:25 Type 24testdata/Internals.lc 15:24-15:25 Type
22testdata/Internals.lc 15:6-15:12 Type 25testdata/Internals.lc 15:6-15:12 Type
23testdata/Internals.lc 15:17-15:23 {a} -> a -> 'Tuple1 a 26testdata/Internals.lc 15:17-15:23 {a} -> a -> 'Tuple1 a
27testdata/Internals.lc 15:6-15:23 Type
28testdata/Internals.lc 15:17-15:23 Type
29testdata/Internals.lc 15:17-15:23 'Tuple1 V2
24testdata/Internals.lc 16:6-16:12 Type -> Type->Type 30testdata/Internals.lc 16:6-16:12 Type -> Type->Type
25testdata/Internals.lc 16:6-16:29 Type 31testdata/Internals.lc 16:6-16:29 Type
26testdata/Internals.lc 16:26-16:27 Type 32testdata/Internals.lc 16:26-16:27 Type
27testdata/Internals.lc 16:28-16:29 Type 33testdata/Internals.lc 16:28-16:29 Type
28testdata/Internals.lc 16:6-16:12 Type 34testdata/Internals.lc 16:6-16:12 Type
29testdata/Internals.lc 16:19-16:25 {a} -> {b} -> a -> b -> 'Tuple2 a b 35testdata/Internals.lc 16:19-16:25 {a} -> {b} -> a -> b -> 'Tuple2 a b
36testdata/Internals.lc 16:6-16:25 Type
37testdata/Internals.lc 16:19-16:25 Type
38testdata/Internals.lc 16:19-16:25 'Tuple2 V4 V3
30testdata/Internals.lc 17:6-17:12 Type -> Type -> Type->Type 39testdata/Internals.lc 17:6-17:12 Type -> Type -> Type->Type
31testdata/Internals.lc 17:6-17:33 Type 40testdata/Internals.lc 17:6-17:33 Type
32testdata/Internals.lc 17:28-17:29 Type 41testdata/Internals.lc 17:28-17:29 Type
@@ -34,6 +43,9 @@ testdata/Internals.lc 17:30-17:31 Type
34testdata/Internals.lc 17:32-17:33 Type 43testdata/Internals.lc 17:32-17:33 Type
35testdata/Internals.lc 17:6-17:12 Type 44testdata/Internals.lc 17:6-17:12 Type
36testdata/Internals.lc 17:21-17:27 {a} -> {b} -> {c} -> a -> b -> c -> 'Tuple3 a b c 45testdata/Internals.lc 17:21-17:27 {a} -> {b} -> {c} -> a -> b -> c -> 'Tuple3 a b c
46testdata/Internals.lc 17:6-17:27 Type
47testdata/Internals.lc 17:21-17:27 Type
48testdata/Internals.lc 17:21-17:27 'Tuple3 V6 V5 V4
37testdata/Internals.lc 18:6-18:12 Type -> Type -> Type -> Type->Type 49testdata/Internals.lc 18:6-18:12 Type -> Type -> Type -> Type->Type
38testdata/Internals.lc 18:6-18:37 Type 50testdata/Internals.lc 18:6-18:37 Type
39testdata/Internals.lc 18:30-18:31 Type 51testdata/Internals.lc 18:30-18:31 Type
@@ -42,6 +54,9 @@ testdata/Internals.lc 18:34-18:35 Type
42testdata/Internals.lc 18:36-18:37 Type 54testdata/Internals.lc 18:36-18:37 Type
43testdata/Internals.lc 18:6-18:12 Type 55testdata/Internals.lc 18:6-18:12 Type
44testdata/Internals.lc 18:23-18:29 {a} -> {b} -> {c} -> {d} -> a -> b -> c -> d -> 'Tuple4 a b c d 56testdata/Internals.lc 18:23-18:29 {a} -> {b} -> {c} -> {d} -> a -> b -> c -> d -> 'Tuple4 a b c d
57testdata/Internals.lc 18:6-18:29 Type
58testdata/Internals.lc 18:23-18:29 Type
59testdata/Internals.lc 18:23-18:29 'Tuple4 V8 V7 V6 V5
45testdata/Internals.lc 19:6-19:12 Type -> Type -> Type -> Type -> Type->Type 60testdata/Internals.lc 19:6-19:12 Type -> Type -> Type -> Type -> Type->Type
46testdata/Internals.lc 19:6-19:41 Type 61testdata/Internals.lc 19:6-19:41 Type
47testdata/Internals.lc 19:32-19:33 Type 62testdata/Internals.lc 19:32-19:33 Type
@@ -51,6 +66,9 @@ testdata/Internals.lc 19:38-19:39 Type
51testdata/Internals.lc 19:40-19:41 Type 66testdata/Internals.lc 19:40-19:41 Type
52testdata/Internals.lc 19:6-19:12 Type 67testdata/Internals.lc 19:6-19:12 Type
53testdata/Internals.lc 19:25-19:31 {a} -> {b} -> {c} -> {d} -> {e} -> a -> b -> c -> d -> e -> 'Tuple5 a b c d e 68testdata/Internals.lc 19:25-19:31 {a} -> {b} -> {c} -> {d} -> {e} -> a -> b -> c -> d -> e -> 'Tuple5 a b c d e
69testdata/Internals.lc 19:6-19:31 Type
70testdata/Internals.lc 19:25-19:31 Type
71testdata/Internals.lc 19:25-19:31 'Tuple5 V10 V9 V8 V7 V6
54testdata/Internals.lc 25:24-25:35 Type 72testdata/Internals.lc 25:24-25:35 Type
55testdata/Internals.lc 25:24-25:25 V1 73testdata/Internals.lc 25:24-25:25 V1
56testdata/Internals.lc 25:29-25:35 Type 74testdata/Internals.lc 25:29-25:35 Type
@@ -75,10 +93,12 @@ testdata/Internals.lc 37:6-37:10 Type
75testdata/Internals.lc 39:6-39:10 Type 93testdata/Internals.lc 39:6-39:10 Type
76testdata/Internals.lc 39:13-39:18 'Bool 94testdata/Internals.lc 39:13-39:18 'Bool
77testdata/Internals.lc 39:21-39:25 'Bool 95testdata/Internals.lc 39:21-39:25 'Bool
96testdata/Internals.lc 39:6-39:25 Type
78testdata/Internals.lc 41:6-41:14 Type 97testdata/Internals.lc 41:6-41:14 Type
79testdata/Internals.lc 41:17-41:19 'Ordering 98testdata/Internals.lc 41:17-41:19 'Ordering
80testdata/Internals.lc 41:22-41:24 'Ordering 99testdata/Internals.lc 41:22-41:24 'Ordering
81testdata/Internals.lc 41:27-41:29 'Ordering 100testdata/Internals.lc 41:27-41:29 'Ordering
101testdata/Internals.lc 41:6-41:29 Type
82testdata/Internals.lc 44:24-44:27 Type 102testdata/Internals.lc 44:24-44:27 Type
83testdata/Internals.lc 44:33-44:37 Type 103testdata/Internals.lc 44:33-44:37 Type
84testdata/Internals.lc 44:1-44:14 'Int->'Word 104testdata/Internals.lc 44:1-44:14 'Int->'Word
diff --git a/testdata/Material.out b/testdata/Material.out
index b752ab32..4919e496 100644
--- a/testdata/Material.out
+++ b/testdata/Material.out
@@ -15,16 +15,19 @@ testdata/Material.lc 14:34-14:39 Type
15testdata/Material.lc 15:28-15:31 'Nat -> Type->Type 15testdata/Material.lc 15:28-15:31 'Nat -> Type->Type
16testdata/Material.lc 15:34-15:39 Type 16testdata/Material.lc 15:34-15:39 Type
17testdata/Material.lc 11:7-11:13 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'VecS 'Float (Succ (Succ (Succ Zero))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'Entity 17testdata/Material.lc 11:7-11:13 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'VecS 'Float (Succ (Succ (Succ Zero))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'Entity
18testdata/Material.lc 10:6-11:13 Type
19testdata/Material.lc 11:7-11:13 Type
20testdata/Material.lc 11:7-11:13 'Entity
18testdata/Material.lc 11:7-11:13 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'VecS 'Float (Succ (Succ (Succ Zero))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> V4 21testdata/Material.lc 11:7-11:13 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'VecS 'Float (Succ (Succ (Succ Zero))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> V4
19testdata/Material.lc 11:7-11:13 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'VecS 'Float (Succ (Succ (Succ Zero))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> V4 22testdata/Material.lc 11:7-11:13 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> 'VecS 'Float (Succ (Succ (Succ Zero))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> V4
20testdata/Material.lc 11:7-11:13 'VecS 'Float (Succ (Succ (Succ Zero))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> V4 23testdata/Material.lc 11:7-11:13 'VecS 'Float (Succ (Succ (Succ Zero))) -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> V4
21testdata/Material.lc 11:7-11:13 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> V4 24testdata/Material.lc 11:7-11:13 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) -> V4
22testdata/Material.lc 11:7-11:13 V4 25testdata/Material.lc 11:7-11:13 V4
23testdata/Material.lc 11:7-11:13 'VecS 'Float (Succ (Succ (Succ Zero))) 26testdata/Material.lc 11:7-11:13 'VecS 'Float (Succ (Succ (Succ (Succ Zero))))
24testdata/Material.lc 11:7-11:13 'Entity
25testdata/Material.lc 11:7-11:13 V1 27testdata/Material.lc 11:7-11:13 V1
28testdata/Material.lc 15:7-15:18 'Entity -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero))))
29testdata/Material.lc 11:7-11:13 'VecS 'Float (Succ (Succ (Succ Zero)))
26testdata/Material.lc 14:7-14:16 'Entity -> 'VecS 'Float (Succ (Succ (Succ Zero))) 30testdata/Material.lc 14:7-14:16 'Entity -> 'VecS 'Float (Succ (Succ (Succ Zero)))
27testdata/Material.lc 11:7-11:13 'VecS 'Float (Succ (Succ (Succ (Succ Zero))))
28testdata/Material.lc 13:7-13:21 'Entity -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) 31testdata/Material.lc 13:7-13:21 'Entity -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero))))
29testdata/Material.lc 12:7-12:20 'Entity -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero)))) 32testdata/Material.lc 12:7-12:20 'Entity -> 'VecS 'Float (Succ (Succ (Succ (Succ Zero))))
30testdata/Material.lc 18:6-18:14 Type 33testdata/Material.lc 18:6-18:14 Type
@@ -34,6 +37,7 @@ testdata/Material.lc 21:7-21:16 'WaveType
34testdata/Material.lc 22:7-22:18 'WaveType 37testdata/Material.lc 22:7-22:18 'WaveType
35testdata/Material.lc 23:7-23:25 'WaveType 38testdata/Material.lc 23:7-23:25 'WaveType
36testdata/Material.lc 24:7-24:15 'WaveType 39testdata/Material.lc 24:7-24:15 'WaveType
40testdata/Material.lc 18:6-24:15 Type
37testdata/Material.lc 27:6-27:10 Type 41testdata/Material.lc 27:6-27:10 Type
38testdata/Material.lc 27:18-27:26 Type 42testdata/Material.lc 27:18-27:26 Type
39testdata/Material.lc 27:6-27:50 Type 43testdata/Material.lc 27:6-27:50 Type
@@ -42,6 +46,9 @@ testdata/Material.lc 27:33-27:38 Type
42testdata/Material.lc 27:39-27:44 Type 46testdata/Material.lc 27:39-27:44 Type
43testdata/Material.lc 27:45-27:50 Type 47testdata/Material.lc 27:45-27:50 Type
44testdata/Material.lc 27:13-27:17 'WaveType -> 'Float -> 'Float -> 'Float -> 'Float->'Wave 48testdata/Material.lc 27:13-27:17 'WaveType -> 'Float -> 'Float -> 'Float -> 'Float->'Wave
49testdata/Material.lc 27:6-27:17 Type
50testdata/Material.lc 27:13-27:17 Type
51testdata/Material.lc 27:13-27:17 'Wave
45testdata/Material.lc 29:6-29:12 Type 52testdata/Material.lc 29:6-29:12 Type
46testdata/Material.lc 30:7-30:19 'Deform 53testdata/Material.lc 30:7-30:19 'Deform
47testdata/Material.lc 31:7-31:20 'Deform 54testdata/Material.lc 31:7-31:20 'Deform
@@ -72,10 +79,20 @@ testdata/Material.lc 44:14-44:19 Type
72testdata/Material.lc 29:6-44:24 Type 79testdata/Material.lc 29:6-44:24 Type
73testdata/Material.lc 44:20-44:24 Type 80testdata/Material.lc 44:20-44:24 Type
74testdata/Material.lc 44:7-44:13 'Float -> 'Wave->'Deform 81testdata/Material.lc 44:7-44:13 'Float -> 'Wave->'Deform
82testdata/Material.lc 29:6-44:13 Type
83testdata/Material.lc 32:7-32:14 Type
84testdata/Material.lc 32:7-32:14 'Deform
85testdata/Material.lc 33:7-33:13 Type
86testdata/Material.lc 33:7-33:13 'Deform
87testdata/Material.lc 34:7-34:15 Type
88testdata/Material.lc 34:7-34:15 'Deform
89testdata/Material.lc 44:7-44:13 Type
90testdata/Material.lc 44:7-44:13 'Deform
75testdata/Material.lc 47:6-47:14 Type 91testdata/Material.lc 47:6-47:14 Type
76testdata/Material.lc 48:7-48:20 'CullType 92testdata/Material.lc 48:7-48:20 'CullType
77testdata/Material.lc 49:7-49:19 'CullType 93testdata/Material.lc 49:7-49:19 'CullType
78testdata/Material.lc 50:7-50:18 'CullType 94testdata/Material.lc 50:7-50:18 'CullType
95testdata/Material.lc 47:6-50:18 Type
79testdata/Material.lc 53:6-53:15 Type 96testdata/Material.lc 53:6-53:15 Type
80testdata/Material.lc 54:7-54:17 'Blending' 97testdata/Material.lc 54:7-54:17 'Blending'
81testdata/Material.lc 55:7-55:17 'Blending' 98testdata/Material.lc 55:7-55:17 'Blending'
@@ -88,6 +105,7 @@ testdata/Material.lc 61:7-61:17 'Blending'
88testdata/Material.lc 62:7-62:25 'Blending' 105testdata/Material.lc 62:7-62:25 'Blending'
89testdata/Material.lc 63:7-63:17 'Blending' 106testdata/Material.lc 63:7-63:17 'Blending'
90testdata/Material.lc 64:7-64:13 'Blending' 107testdata/Material.lc 64:7-64:13 'Blending'
108testdata/Material.lc 53:6-64:13 Type
91testdata/Material.lc 67:6-67:12 Type 109testdata/Material.lc 67:6-67:12 Type
92testdata/Material.lc 68:16-68:20 Type 110testdata/Material.lc 68:16-68:20 Type
93testdata/Material.lc 68:7-68:15 'Wave->'RGBGen 111testdata/Material.lc 68:7-68:15 'Wave->'RGBGen
@@ -105,6 +123,11 @@ testdata/Material.lc 75:7-75:17 'RGBGen
105testdata/Material.lc 76:7-76:26 'RGBGen 123testdata/Material.lc 76:7-76:26 'RGBGen
106testdata/Material.lc 77:7-77:25 'RGBGen 124testdata/Material.lc 77:7-77:25 'RGBGen
107testdata/Material.lc 78:7-78:20 'RGBGen 125testdata/Material.lc 78:7-78:20 'RGBGen
126testdata/Material.lc 67:6-78:20 Type
127testdata/Material.lc 68:7-68:15 Type
128testdata/Material.lc 68:7-68:15 'RGBGen
129testdata/Material.lc 69:7-69:16 Type
130testdata/Material.lc 69:7-69:16 'RGBGen
108testdata/Material.lc 81:6-81:14 Type 131testdata/Material.lc 81:6-81:14 Type
109testdata/Material.lc 82:14-82:18 Type 132testdata/Material.lc 82:14-82:18 Type
110testdata/Material.lc 82:7-82:13 'Wave->'AlphaGen 133testdata/Material.lc 82:7-82:13 'Wave->'AlphaGen
@@ -117,6 +140,11 @@ testdata/Material.lc 87:7-87:23 'AlphaGen
117testdata/Material.lc 88:7-88:15 'AlphaGen 140testdata/Material.lc 88:7-88:15 'AlphaGen
118testdata/Material.lc 89:7-89:25 'AlphaGen 141testdata/Material.lc 89:7-89:25 'AlphaGen
119testdata/Material.lc 90:7-90:23 'AlphaGen 142testdata/Material.lc 90:7-90:23 'AlphaGen
143testdata/Material.lc 81:6-90:23 Type
144testdata/Material.lc 82:7-82:13 Type
145testdata/Material.lc 82:7-82:13 'AlphaGen
146testdata/Material.lc 83:7-83:14 Type
147testdata/Material.lc 83:7-83:14 'AlphaGen
120testdata/Material.lc 93:6-93:11 Type 148testdata/Material.lc 93:6-93:11 Type
121testdata/Material.lc 94:7-94:14 'TCGen 149testdata/Material.lc 94:7-94:14 'TCGen
122testdata/Material.lc 95:7-95:18 'TCGen 150testdata/Material.lc 95:7-95:18 'TCGen
@@ -128,6 +156,9 @@ testdata/Material.lc 97:32-97:35 'Nat -> Type->Type
128testdata/Material.lc 97:38-97:43 Type 156testdata/Material.lc 97:38-97:43 Type
129testdata/Material.lc 97:7-97:16 'VecS 'Float (Succ (Succ (Succ Zero))) -> 'VecS 'Float (Succ (Succ (Succ Zero))) -> 'TCGen 157testdata/Material.lc 97:7-97:16 'VecS 'Float (Succ (Succ (Succ Zero))) -> 'VecS 'Float (Succ (Succ (Succ Zero))) -> 'TCGen
130testdata/Material.lc 98:7-98:19 'TCGen 158testdata/Material.lc 98:7-98:19 'TCGen
159testdata/Material.lc 93:6-98:19 Type
160testdata/Material.lc 97:7-97:16 Type
161testdata/Material.lc 97:7-97:16 'TCGen
131testdata/Material.lc 101:6-101:11 Type 162testdata/Material.lc 101:6-101:11 Type
132testdata/Material.lc 102:7-102:25 'TCMod 163testdata/Material.lc 102:7-102:25 'TCMod
133testdata/Material.lc 103:17-103:22 Type 164testdata/Material.lc 103:17-103:22 Type
@@ -156,6 +187,19 @@ testdata/Material.lc 108:21-108:26 Type
156testdata/Material.lc 108:27-108:32 Type 187testdata/Material.lc 108:27-108:32 Type
157testdata/Material.lc 108:33-108:38 Type 188testdata/Material.lc 108:33-108:38 Type
158testdata/Material.lc 108:7-108:14 'Float -> 'Float -> 'Float -> 'Float->'TCMod 189testdata/Material.lc 108:7-108:14 'Float -> 'Float -> 'Float -> 'Float->'TCMod
190testdata/Material.lc 101:6-108:14 Type
191testdata/Material.lc 103:7-103:16 Type
192testdata/Material.lc 103:7-103:16 'TCMod
193testdata/Material.lc 104:7-104:16 Type
194testdata/Material.lc 104:7-104:16 'TCMod
195testdata/Material.lc 105:7-105:15 Type
196testdata/Material.lc 105:7-105:15 'TCMod
197testdata/Material.lc 106:7-106:17 Type
198testdata/Material.lc 106:7-106:17 'TCMod
199testdata/Material.lc 107:7-107:19 Type
200testdata/Material.lc 107:7-107:19 'TCMod
201testdata/Material.lc 108:7-108:14 Type
202testdata/Material.lc 108:7-108:14 'TCMod
159testdata/Material.lc 111:6-111:18 Type 203testdata/Material.lc 111:6-111:18 Type
160testdata/Material.lc 112:21-112:27 Type 204testdata/Material.lc 112:21-112:27 Type
161testdata/Material.lc 112:7-112:13 'String->'StageTexture 205testdata/Material.lc 112:7-112:13 'String->'StageTexture
@@ -167,13 +211,22 @@ testdata/Material.lc 114:28-114:34 Type
167testdata/Material.lc 114:7-114:17 'Float -> 'List 'String -> 'StageTexture 211testdata/Material.lc 114:7-114:17 'Float -> 'List 'String -> 'StageTexture
168testdata/Material.lc 115:7-115:18 'StageTexture 212testdata/Material.lc 115:7-115:18 'StageTexture
169testdata/Material.lc 116:7-116:20 'StageTexture 213testdata/Material.lc 116:7-116:20 'StageTexture
214testdata/Material.lc 111:6-116:20 Type
215testdata/Material.lc 112:7-112:13 Type
216testdata/Material.lc 112:7-112:13 'StageTexture
217testdata/Material.lc 113:7-113:18 Type
218testdata/Material.lc 113:7-113:18 'StageTexture
219testdata/Material.lc 114:7-114:17 Type
220testdata/Material.lc 114:7-114:17 'StageTexture
170testdata/Material.lc 119:6-119:19 Type 221testdata/Material.lc 119:6-119:19 Type
171testdata/Material.lc 120:7-120:12 'AlphaFunction 222testdata/Material.lc 120:7-120:12 'AlphaFunction
172testdata/Material.lc 121:7-121:14 'AlphaFunction 223testdata/Material.lc 121:7-121:14 'AlphaFunction
173testdata/Material.lc 122:7-122:14 'AlphaFunction 224testdata/Material.lc 122:7-122:14 'AlphaFunction
225testdata/Material.lc 119:6-122:14 Type
174testdata/Material.lc 125:6-125:19 Type 226testdata/Material.lc 125:6-125:19 Type
175testdata/Material.lc 126:7-126:14 'DepthFunction 227testdata/Material.lc 126:7-126:14 'DepthFunction
176testdata/Material.lc 127:7-127:15 'DepthFunction 228testdata/Material.lc 127:7-127:15 'DepthFunction
229testdata/Material.lc 125:6-127:15 Type
177testdata/Material.lc 130:6-130:16 Type 230testdata/Material.lc 130:6-130:16 Type
178testdata/Material.lc 132:25-132:30 Type->Type 231testdata/Material.lc 132:25-132:30 Type->Type
179testdata/Material.lc 132:31-132:53 Type 232testdata/Material.lc 132:31-132:53 Type
@@ -193,6 +246,9 @@ testdata/Material.lc 140:31-140:44 Type
193testdata/Material.lc 143:32-143:36 Type 246testdata/Material.lc 143:32-143:36 Type
194testdata/Material.lc 144:28-144:34 Type 247testdata/Material.lc 144:28-144:34 Type
195testdata/Material.lc 131:7-131:17 'Maybe ('Tuple2 'Blending' 'Blending') -> 'RGBGen -> 'AlphaGen -> 'TCGen -> 'List 'TCMod -> 'StageTexture -> 'Bool -> 'DepthFunction -> 'Maybe 'AlphaFunction -> 'Bool -> 'String->'StageAttrs 248testdata/Material.lc 131:7-131:17 'Maybe ('Tuple2 'Blending' 'Blending') -> 'RGBGen -> 'AlphaGen -> 'TCGen -> 'List 'TCMod -> 'StageTexture -> 'Bool -> 'DepthFunction -> 'Maybe 'AlphaFunction -> 'Bool -> 'String->'StageAttrs
249testdata/Material.lc 130:6-131:17 Type
250testdata/Material.lc 131:7-131:17 Type
251testdata/Material.lc 131:7-131:17 'StageAttrs
196testdata/Material.lc 131:7-131:17 'Maybe ('Tuple2 'Blending' 'Blending') -> 'RGBGen -> 'AlphaGen -> 'TCGen -> 'List 'TCMod -> 'StageTexture -> 'Bool -> 'DepthFunction -> 'Maybe 'AlphaFunction -> 'Bool -> 'String->V11 252testdata/Material.lc 131:7-131:17 'Maybe ('Tuple2 'Blending' 'Blending') -> 'RGBGen -> 'AlphaGen -> 'TCGen -> 'List 'TCMod -> 'StageTexture -> 'Bool -> 'DepthFunction -> 'Maybe 'AlphaFunction -> 'Bool -> 'String->V11
197testdata/Material.lc 131:7-131:17 'RGBGen -> 'AlphaGen -> 'TCGen -> 'List 'TCMod -> 'StageTexture -> 'Bool -> 'DepthFunction -> 'Maybe 'AlphaFunction -> 'Bool -> 'String->V11 253testdata/Material.lc 131:7-131:17 'RGBGen -> 'AlphaGen -> 'TCGen -> 'List 'TCMod -> 'StageTexture -> 'Bool -> 'DepthFunction -> 'Maybe 'AlphaFunction -> 'Bool -> 'String->V11
198testdata/Material.lc 131:7-131:17 'AlphaGen -> 'TCGen -> 'List 'TCMod -> 'StageTexture -> 'Bool -> 'DepthFunction -> 'Maybe 'AlphaFunction -> 'Bool -> 'String->V11 254testdata/Material.lc 131:7-131:17 'AlphaGen -> 'TCGen -> 'List 'TCMod -> 'StageTexture -> 'Bool -> 'DepthFunction -> 'Maybe 'AlphaFunction -> 'Bool -> 'String->V11
@@ -205,9 +261,10 @@ testdata/Material.lc 131:7-131:17 'Maybe 'AlphaFunction -> 'Bool -> 'String->V1
205testdata/Material.lc 131:7-131:17 'Bool -> 'String->V11 261testdata/Material.lc 131:7-131:17 'Bool -> 'String->V11
206testdata/Material.lc 131:7-131:17 'String->V11 262testdata/Material.lc 131:7-131:17 'String->V11
207testdata/Material.lc 131:7-131:17 V11 263testdata/Material.lc 131:7-131:17 V11
208testdata/Material.lc 131:7-131:17 'Bool 264testdata/Material.lc 131:7-131:17 'String
209testdata/Material.lc 131:7-131:17 'StageAttrs
210testdata/Material.lc 131:7-131:17 V1 265testdata/Material.lc 131:7-131:17 V1
266testdata/Material.lc 144:7-144:23 'StageAttrs->'String
267testdata/Material.lc 131:7-131:17 'Bool
211testdata/Material.lc 143:7-143:26 'StageAttrs->'Bool 268testdata/Material.lc 143:7-143:26 'StageAttrs->'Bool
212testdata/Material.lc 131:7-131:17 'Maybe 'AlphaFunction 269testdata/Material.lc 131:7-131:17 'Maybe 'AlphaFunction
213testdata/Material.lc 140:7-140:18 'StageAttrs -> 'Maybe 'AlphaFunction 270testdata/Material.lc 140:7-140:18 'StageAttrs -> 'Maybe 'AlphaFunction
@@ -257,6 +314,9 @@ testdata/Material.lc 174:28-174:32 Type
257testdata/Material.lc 175:29-175:39 Type 314testdata/Material.lc 175:29-175:39 Type
258testdata/Material.lc 178:28-178:32 Type 315testdata/Material.lc 178:28-178:32 Type
259testdata/Material.lc 164:7-164:18 'Tuple0 -> 'Tuple0 -> 'Bool -> 'Int -> 'Bool -> 'Bool -> 'CullType -> 'List 'Deform -> 'Bool -> 'Bool -> 'List 'StageAttrs -> 'Bool->'CommonAttrs 316testdata/Material.lc 164:7-164:18 'Tuple0 -> 'Tuple0 -> 'Bool -> 'Int -> 'Bool -> 'Bool -> 'CullType -> 'List 'Deform -> 'Bool -> 'Bool -> 'List 'StageAttrs -> 'Bool->'CommonAttrs
317testdata/Material.lc 163:6-164:18 Type
318testdata/Material.lc 164:7-164:18 Type
319testdata/Material.lc 164:7-164:18 'CommonAttrs
260testdata/Material.lc 164:7-164:18 'Tuple0 -> 'Tuple0 -> 'Bool -> 'Int -> 'Bool -> 'Bool -> 'CullType -> 'List 'Deform -> 'Bool -> 'Bool -> 'List 'StageAttrs -> 'Bool->V12 320testdata/Material.lc 164:7-164:18 'Tuple0 -> 'Tuple0 -> 'Bool -> 'Int -> 'Bool -> 'Bool -> 'CullType -> 'List 'Deform -> 'Bool -> 'Bool -> 'List 'StageAttrs -> 'Bool->V12
261testdata/Material.lc 164:7-164:18 'Tuple0 -> 'Bool -> 'Int -> 'Bool -> 'Bool -> 'CullType -> 'List 'Deform -> 'Bool -> 'Bool -> 'List 'StageAttrs -> 'Bool->V12 321testdata/Material.lc 164:7-164:18 'Tuple0 -> 'Bool -> 'Int -> 'Bool -> 'Bool -> 'CullType -> 'List 'Deform -> 'Bool -> 'Bool -> 'List 'StageAttrs -> 'Bool->V12
262testdata/Material.lc 164:7-164:18 'Bool -> 'Int -> 'Bool -> 'Bool -> 'CullType -> 'List 'Deform -> 'Bool -> 'Bool -> 'List 'StageAttrs -> 'Bool->V12 322testdata/Material.lc 164:7-164:18 'Bool -> 'Int -> 'Bool -> 'Bool -> 'CullType -> 'List 'Deform -> 'Bool -> 'Bool -> 'List 'StageAttrs -> 'Bool->V12
@@ -270,11 +330,11 @@ testdata/Material.lc 164:7-164:18 'Bool -> 'List 'StageAttrs -> 'Bool->V12
270testdata/Material.lc 164:7-164:18 'List 'StageAttrs -> 'Bool->V12 330testdata/Material.lc 164:7-164:18 'List 'StageAttrs -> 'Bool->V12
271testdata/Material.lc 164:7-164:18 'Bool->V12 331testdata/Material.lc 164:7-164:18 'Bool->V12
272testdata/Material.lc 164:7-164:18 V12 332testdata/Material.lc 164:7-164:18 V12
273testdata/Material.lc 164:7-164:18 'List 'StageAttrs 333testdata/Material.lc 164:7-164:18 'Bool
274testdata/Material.lc 164:7-164:18 'CommonAttrs
275testdata/Material.lc 164:7-164:18 V1 334testdata/Material.lc 164:7-164:18 V1
335testdata/Material.lc 178:7-178:14 'CommonAttrs->'Bool
336testdata/Material.lc 164:7-164:18 'List 'StageAttrs
276testdata/Material.lc 175:7-175:15 'CommonAttrs -> 'List 'StageAttrs 337testdata/Material.lc 175:7-175:15 'CommonAttrs -> 'List 'StageAttrs
277testdata/Material.lc 164:7-164:18 'Bool
278testdata/Material.lc 174:7-174:22 'CommonAttrs->'Bool 338testdata/Material.lc 174:7-174:22 'CommonAttrs->'Bool
279testdata/Material.lc 173:7-173:18 'CommonAttrs->'Bool 339testdata/Material.lc 173:7-173:18 'CommonAttrs->'Bool
280testdata/Material.lc 164:7-164:18 'List 'Deform 340testdata/Material.lc 164:7-164:18 'List 'Deform
diff --git a/testdata/Prelude.out b/testdata/Prelude.out
index 4af75bcd..17c94c1c 100644
--- a/testdata/Prelude.out
+++ b/testdata/Prelude.out
@@ -406,6 +406,10 @@ testdata/Prelude.lc 91:7-91:14 {a} -> 'Maybe a
406testdata/Prelude.lc 90:6-92:13 Type 406testdata/Prelude.lc 90:6-92:13 Type
407testdata/Prelude.lc 92:12-92:13 Type 407testdata/Prelude.lc 92:12-92:13 Type
408testdata/Prelude.lc 92:7-92:11 {a} -> a -> 'Maybe a 408testdata/Prelude.lc 92:7-92:11 {a} -> a -> 'Maybe a
409testdata/Prelude.lc 90:6-92:11 Type
410testdata/Prelude.lc 91:7-91:14 'Maybe V1
411testdata/Prelude.lc 92:7-92:11 Type
412testdata/Prelude.lc 92:7-92:11 'Maybe V3
409testdata/Prelude.lc 96:14-96:15 V2 -> V2->V2 413testdata/Prelude.lc 96:14-96:15 V2 -> V2->V2
410testdata/Prelude.lc 96:14-96:15 V2->V2 414testdata/Prelude.lc 96:14-96:15 V2->V2
411testdata/Prelude.lc 96:14-96:15 V2 415testdata/Prelude.lc 96:14-96:15 V2
@@ -455,6 +459,9 @@ testdata/Prelude.lc 104:36-104:38 'List ('Tuple2 V0 Type)
455testdata/Prelude.lc 104:36-104:38 'List ('Tuple2 'String Type) 459testdata/Prelude.lc 104:36-104:38 'List ('Tuple2 'String Type)
456testdata/Prelude.lc 103:6-103:13 Type 460testdata/Prelude.lc 103:6-103:13 Type
457testdata/Prelude.lc 104:7-104:17 {a : 'List ('Tuple2 'String Type)} -> tuptype (map ('Tuple2 'String Type) Type (\(b : 'Tuple2 'String Type) -> snd 'String Type b) a) -> 'RecordC a 461testdata/Prelude.lc 104:7-104:17 {a : 'List ('Tuple2 'String Type)} -> tuptype (map ('Tuple2 'String Type) Type (\(b : 'Tuple2 'String Type) -> snd 'String Type b) a) -> 'RecordC a
462testdata/Prelude.lc 103:6-104:17 Type
463testdata/Prelude.lc 104:7-104:17 Type
464testdata/Prelude.lc 104:7-104:17 'RecordC V2
458testdata/Prelude.lc 106:1-106:7 {a} -> a->a -> a 465testdata/Prelude.lc 106:1-106:7 {a} -> a->a -> a
459testdata/Prelude.lc 106:11-107:36 V0->V1 466testdata/Prelude.lc 106:11-107:36 V0->V1
460testdata/Prelude.lc 106:11-107:36 V1 467testdata/Prelude.lc 106:11-107:36 V1
diff --git a/testdata/ambig.out b/testdata/ambig.out
index 6c9fb611..e309814c 100644
--- a/testdata/ambig.out
+++ b/testdata/ambig.out
@@ -6,6 +6,9 @@ testdata/ambig.lc 3:26-3:27 Type
6testdata/ambig.lc 3:28-3:29 Type 6testdata/ambig.lc 3:28-3:29 Type
7testdata/ambig.lc 3:6-3:12 Type 7testdata/ambig.lc 3:6-3:12 Type
8testdata/ambig.lc 3:19-3:25 {a} -> {b} -> a -> b -> 'Tuple2 a b 8testdata/ambig.lc 3:19-3:25 {a} -> {b} -> a -> b -> 'Tuple2 a b
9testdata/ambig.lc 3:6-3:25 Type
10testdata/ambig.lc 3:19-3:25 Type
11testdata/ambig.lc 3:19-3:25 'Tuple2 V4 V3
9testdata/ambig.lc 8:21-8:26 V2 -> V2->V2 12testdata/ambig.lc 8:21-8:26 V2 -> V2->V2
10testdata/ambig.lc 8:21-8:26 V2->V2 13testdata/ambig.lc 8:21-8:26 V2->V2
11testdata/ambig.lc 8:21-8:26 V2 14testdata/ambig.lc 8:21-8:26 V2
diff --git a/testdata/complex.out b/testdata/complex.out
index 9a824fdc..083010e5 100644
--- a/testdata/complex.out
+++ b/testdata/complex.out
@@ -3,6 +3,7 @@ tooltips:
3testdata/complex.lc 3:6-3:10 Type 3testdata/complex.lc 3:6-3:10 Type
4testdata/complex.lc 3:13-3:19 'Repr 4testdata/complex.lc 3:13-3:19 'Repr
5testdata/complex.lc 3:22-3:27 'Repr 5testdata/complex.lc 3:22-3:27 'Repr
6testdata/complex.lc 3:6-3:27 Type
6testdata/complex.lc 5:17-5:21 Type 7testdata/complex.lc 5:17-5:21 Type
7testdata/complex.lc 5:25-5:29 Type 8testdata/complex.lc 5:25-5:29 Type
8testdata/complex.lc 5:6-5:13 'Repr->Type 9testdata/complex.lc 5:6-5:13 'Repr->Type
@@ -15,7 +16,10 @@ testdata/complex.lc 6:43-6:50 'Repr->Type
15testdata/complex.lc 6:51-6:52 'Repr 16testdata/complex.lc 6:51-6:52 'Repr
16testdata/complex.lc 6:51-6:52 V3 17testdata/complex.lc 6:51-6:52 V3
17testdata/complex.lc 6:3-6:10 {a:'Repr} -> 'Float -> 'Float -> 'Complex a 18testdata/complex.lc 6:3-6:10 {a:'Repr} -> 'Float -> 'Float -> 'Complex a
18testdata/complex.lc 6:51-6:52 Type 19testdata/complex.lc 5:6-5:13 Type
20testdata/complex.lc 5:6-6:52 Type
21testdata/complex.lc 6:3-6:52 Type
22testdata/complex.lc 6:3-6:10 'Complex V2
19testdata/complex.lc 8:20-8:37 Type 23testdata/complex.lc 8:20-8:37 Type
20testdata/complex.lc 8:20-8:27 'Repr->Type 24testdata/complex.lc 8:20-8:27 'Repr->Type
21testdata/complex.lc 8:28-8:29 'Repr 25testdata/complex.lc 8:28-8:29 'Repr
diff --git a/testdata/data.out b/testdata/data.out
index ab8765f8..97814586 100644
--- a/testdata/data.out
+++ b/testdata/data.out
@@ -2,6 +2,7 @@ main is not found
2tooltips: 2tooltips:
3testdata/data.lc 1:6-1:11 Type 3testdata/data.lc 1:6-1:11 Type
4testdata/data.lc 1:14-1:19 'Data0 4testdata/data.lc 1:14-1:19 'Data0
5testdata/data.lc 1:6-1:19 Type
5testdata/data.lc 3:6-3:11 Type -> Type -> Type->Type 6testdata/data.lc 3:6-3:11 Type -> Type -> Type->Type
6testdata/data.lc 3:6-3:31 Type 7testdata/data.lc 3:6-3:31 Type
7testdata/data.lc 3:26-3:27 Type 8testdata/data.lc 3:26-3:27 Type
@@ -9,6 +10,9 @@ testdata/data.lc 3:28-3:29 Type
9testdata/data.lc 3:30-3:31 Type 10testdata/data.lc 3:30-3:31 Type
10testdata/data.lc 3:6-3:11 Type 11testdata/data.lc 3:6-3:11 Type
11testdata/data.lc 3:20-3:25 {a} -> {b} -> {c} -> a -> b -> c -> 'Data1 a b c 12testdata/data.lc 3:20-3:25 {a} -> {b} -> {c} -> a -> b -> c -> 'Data1 a b c
13testdata/data.lc 3:6-3:25 Type
14testdata/data.lc 3:20-3:25 Type
15testdata/data.lc 3:20-3:25 'Data1 V6 V5 V4
12testdata/data.lc 5:6-5:11 Type 16testdata/data.lc 5:6-5:11 Type
13testdata/data.lc 5:21-5:24 Type 17testdata/data.lc 5:21-5:24 Type
14testdata/data.lc 5:14-5:20 'Int->'Data2 18testdata/data.lc 5:14-5:20 'Int->'Data2
@@ -19,13 +23,24 @@ testdata/data.lc 6:14-6:20 'Int -> 'Int->'Data2
19testdata/data.lc 7:28-7:31 Type 23testdata/data.lc 7:28-7:31 Type
20testdata/data.lc 7:14-7:20 'Int->'Data2 24testdata/data.lc 7:14-7:20 'Int->'Data2
21testdata/data.lc 8:14-8:20 'Data2 25testdata/data.lc 8:14-8:20 'Data2
26testdata/data.lc 5:6-8:20 Type
27testdata/data.lc 5:14-5:20 Type
28testdata/data.lc 5:14-5:20 'Data2
29testdata/data.lc 6:14-6:20 Type
30testdata/data.lc 6:14-6:20 'Data2
31testdata/data.lc 7:14-7:20 Type
32testdata/data.lc 7:14-7:20 'Data2
22testdata/data.lc 6:14-6:20 'Int -> 'Int->V2 33testdata/data.lc 6:14-6:20 'Int -> 'Int->V2
23testdata/data.lc 6:14-6:20 'Int->V2 34testdata/data.lc 6:14-6:20 'Int->V2
24testdata/data.lc 6:14-6:20 V2 35testdata/data.lc 6:14-6:20 V2
25testdata/data.lc 6:14-6:20 'Int 36testdata/data.lc 6:14-6:20 'Int
26testdata/data.lc 6:14-6:20 'Data2
27testdata/data.lc 6:14-6:20 V1 37testdata/data.lc 6:14-6:20 V1
38testdata/data.lc 6:33-6:34 'Data2->'Int
28testdata/data.lc 6:23-6:24 'Data2->'Int 39testdata/data.lc 6:23-6:24 'Data2->'Int
40testdata/data.lc 7:14-7:20 'Int->V1
41testdata/data.lc 7:14-7:20 V1
42testdata/data.lc 7:14-7:20 'Int
43testdata/data.lc 7:23-7:24 'Data2->'Int
29testdata/data.lc 10:6-10:11 Type -> Type -> Type->Type 44testdata/data.lc 10:6-10:11 Type -> Type -> Type->Type
30testdata/data.lc 10:6-10:38 Type 45testdata/data.lc 10:6-10:38 Type
31testdata/data.lc 10:36-10:38 Type 46testdata/data.lc 10:36-10:38 Type
@@ -43,13 +58,26 @@ testdata/data.lc 12:37-12:42 Type
43testdata/data.lc 12:43-12:45 Type 58testdata/data.lc 12:43-12:45 Type
44testdata/data.lc 12:46-12:48 Type 59testdata/data.lc 12:46-12:48 Type
45testdata/data.lc 12:23-12:29 {a} -> {b} -> {c} -> 'Int -> a -> 'Float -> b -> c -> 'Data5 a b c 60testdata/data.lc 12:23-12:29 {a} -> {b} -> {c} -> 'Int -> a -> 'Float -> b -> c -> 'Data5 a b c
61testdata/data.lc 10:6-12:29 Type
62testdata/data.lc 10:23-10:29 Type
63testdata/data.lc 10:23-10:29 'Data5 V4 V3 V2
64testdata/data.lc 11:23-11:29 Type
65testdata/data.lc 11:23-11:29 'Data5 V7 V6 V5
66testdata/data.lc 12:23-12:29 Type
67testdata/data.lc 12:23-12:29 'Data5 V10 V9 V8
68testdata/data.lc 10:23-10:29 V3->V1
69testdata/data.lc 10:23-10:29 V1
70testdata/data.lc 10:23-10:29 V4
71testdata/data.lc 10:23-10:29 'Data5 V2 V1 V0
72testdata/data.lc 10:32-10:34 {a} -> {b} -> {c} -> 'Data5 a b c -> a
46testdata/data.lc 11:23-11:29 V3 -> V3 -> V3->V3 73testdata/data.lc 11:23-11:29 V3 -> V3 -> V3->V3
47testdata/data.lc 11:23-11:29 V3 -> V3->V3 74testdata/data.lc 11:23-11:29 V3 -> V3->V3
48testdata/data.lc 11:23-11:29 V3->V3 75testdata/data.lc 11:23-11:29 V3->V3
49testdata/data.lc 11:23-11:29 V3 76testdata/data.lc 11:23-11:29 V3
50testdata/data.lc 11:23-11:29 V5
51testdata/data.lc 11:23-11:29 'Data5 V2 V1 V0
52testdata/data.lc 11:23-11:29 V4 77testdata/data.lc 11:23-11:29 V4
78testdata/data.lc 11:23-11:29 'Data5 V2 V1 V0
79testdata/data.lc 11:48-11:50 {a} -> {b} -> {c} -> 'Data5 a b c -> c
80testdata/data.lc 11:23-11:29 V5
53testdata/data.lc 11:40-11:42 {a} -> {b} -> {c} -> 'Data5 a b c -> b 81testdata/data.lc 11:40-11:42 {a} -> {b} -> {c} -> 'Data5 a b c -> b
54testdata/data.lc 11:23-11:29 V6 82testdata/data.lc 11:23-11:29 V6
55testdata/data.lc 11:32-11:34 {a} -> {b} -> {c} -> 'Data5 a b c -> a 83testdata/data.lc 11:32-11:34 {a} -> {b} -> {c} -> 'Data5 a b c -> a
diff --git a/testdata/language-features/basic-values/data01.out b/testdata/language-features/basic-values/data01.out
index e575c0c6..3507b1ab 100644
--- a/testdata/language-features/basic-values/data01.out
+++ b/testdata/language-features/basic-values/data01.out
@@ -4,13 +4,20 @@ testdata/language-features/basic-values/data01.lc 1:6-1:7 Type
4testdata/language-features/basic-values/data01.lc 1:8-1:9 'A 4testdata/language-features/basic-values/data01.lc 1:8-1:9 'A
5testdata/language-features/basic-values/data01.lc 1:10-1:11 'A 5testdata/language-features/basic-values/data01.lc 1:10-1:11 'A
6testdata/language-features/basic-values/data01.lc 1:12-1:13 'A 6testdata/language-features/basic-values/data01.lc 1:12-1:13 'A
7testdata/language-features/basic-values/data01.lc 1:6-1:13 Type
7testdata/language-features/basic-values/data01.lc 3:6-3:7 Type 8testdata/language-features/basic-values/data01.lc 3:6-3:7 Type
8testdata/language-features/basic-values/data01.lc 3:10-3:11 'E 9testdata/language-features/basic-values/data01.lc 3:10-3:11 'E
9testdata/language-features/basic-values/data01.lc 3:16-3:18 Type 10testdata/language-features/basic-values/data01.lc 3:16-3:18 Type
10testdata/language-features/basic-values/data01.lc 3:14-3:15 'Tuple0->'E 11testdata/language-features/basic-values/data01.lc 3:14-3:15 'Tuple0->'E
11testdata/language-features/basic-values/data01.lc 3:21-3:22 'E 12testdata/language-features/basic-values/data01.lc 3:21-3:22 'E
13testdata/language-features/basic-values/data01.lc 3:6-3:22 Type
14testdata/language-features/basic-values/data01.lc 3:14-3:15 Type
15testdata/language-features/basic-values/data01.lc 3:14-3:15 'E
12testdata/language-features/basic-values/data01.lc 5:6-5:8 Type 16testdata/language-features/basic-values/data01.lc 5:6-5:8 Type
13testdata/language-features/basic-values/data01.lc 5:9-5:11 'D1 17testdata/language-features/basic-values/data01.lc 5:9-5:11 'D1
14testdata/language-features/basic-values/data01.lc 6:7-6:9 Type 18testdata/language-features/basic-values/data01.lc 6:7-6:9 Type
15testdata/language-features/basic-values/data01.lc 6:5-6:7 'Tuple0->'D1 19testdata/language-features/basic-values/data01.lc 6:5-6:7 'Tuple0->'D1
16testdata/language-features/basic-values/data01.lc 6:11-6:13 'D1 20testdata/language-features/basic-values/data01.lc 6:11-6:13 'D1
21testdata/language-features/basic-values/data01.lc 5:6-6:13 Type
22testdata/language-features/basic-values/data01.lc 6:5-6:7 Type
23testdata/language-features/basic-values/data01.lc 6:5-6:7 'D1
diff --git a/testdata/traceTest.out b/testdata/traceTest.out
index adbb4fa4..16b64fc4 100644
--- a/testdata/traceTest.out
+++ b/testdata/traceTest.out
@@ -4,6 +4,8 @@ testdata/traceTest.lc 6:8-6:9 V1
4testdata/traceTest.lc 6:1-6:3 {a} -> a->a 4testdata/traceTest.lc 6:1-6:3 {a} -> a->a
5testdata/traceTest.lc 8:17-8:18 Type 5testdata/traceTest.lc 8:17-8:18 Type
6testdata/traceTest.lc 8:6-8:7 {a} -> a->Type 6testdata/traceTest.lc 8:6-8:7 {a} -> a->Type
7testdata/traceTest.lc 8:6-8:18 Type
8testdata/traceTest.lc 8:6-8:7 Type
7testdata/traceTest.lc 10:6-10:24 Type 9testdata/traceTest.lc 10:6-10:24 Type
8testdata/traceTest.lc 10:6-10:7 {a} -> a->Type 10testdata/traceTest.lc 10:6-10:7 {a} -> a->Type
9testdata/traceTest.lc 10:9-10:24 V0 11testdata/traceTest.lc 10:9-10:24 V0
diff --git a/testdata/typeclass.out b/testdata/typeclass.out
index 48d87905..d4817d5c 100644
--- a/testdata/typeclass.out
+++ b/testdata/typeclass.out
@@ -8,6 +8,10 @@ testdata/typeclass.lc 4:26-4:27 Type
8testdata/typeclass.lc 4:29-4:33 Type->Type 8testdata/typeclass.lc 4:29-4:33 Type->Type
9testdata/typeclass.lc 4:34-4:35 Type 9testdata/typeclass.lc 4:34-4:35 Type
10testdata/typeclass.lc 4:21-4:25 {a} -> a -> 'List a -> 'List a 10testdata/typeclass.lc 4:21-4:25 {a} -> a -> 'List a -> 'List a
11testdata/typeclass.lc 4:6-4:25 Type
12testdata/typeclass.lc 4:15-4:18 'List V1
13testdata/typeclass.lc 4:21-4:25 Type
14testdata/typeclass.lc 4:21-4:25 'List V4
11testdata/typeclass.lc 11:13-11:17 V0 15testdata/typeclass.lc 11:13-11:17 V0
12testdata/typeclass.lc 11:13-11:17 'Bool 16testdata/typeclass.lc 11:13-11:17 'Bool
13testdata/typeclass.lc 10:12-10:17 'Bool 17testdata/typeclass.lc 10:12-10:17 'Bool