summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndor Penzes <andor.penzes@gmail.com>2016-01-22 23:58:20 +0100
committerAndor Penzes <andor.penzes@gmail.com>2016-01-22 23:58:20 +0100
commit8e5df5a67b8a92064f3217ce1ca8bcec5884a408 (patch)
treea27667b89d8ac8ee54e61da521bd9f01979bf8c3 /src
parent72c6d50db8ea8f7527208efd191f15368651c328 (diff)
Tweak telescope functions.
Diffstat (limited to 'src')
-rw-r--r--src/LambdaCube/Compiler/Infer.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/LambdaCube/Compiler/Infer.hs b/src/LambdaCube/Compiler/Infer.hs
index 00106612..bd9abc2f 100644
--- a/src/LambdaCube/Compiler/Infer.hs
+++ b/src/LambdaCube/Compiler/Infer.hs
@@ -1718,7 +1718,7 @@ typedIds ns mb = (,) <$> commaSep1 (withSI (varId ns <|> patVar ns <|> upperCase
1718telescope ns mb = (DBNamesC *** id) <$> telescopeSI ns mb 1718telescope ns mb = (DBNamesC *** id) <$> telescopeSI ns mb
1719 1719
1720telescopeSI :: Namespace -> Maybe SExp -> P ([SIName], [(Visibility, SExp)]) -- todo: refactor to [(SIName, (Visibility, SExp))] 1720telescopeSI :: Namespace -> Maybe SExp -> P ([SIName], [(Visibility, SExp)]) -- todo: refactor to [(SIName, (Visibility, SExp))]
1721telescopeSI ns mb = go [] 1721telescopeSI ns mb = first reverse <$> go []
1722 where 1722 where
1723 go vs = option ([], []) $ do 1723 go vs = option ([], []) $ do
1724 (x, vt) <- 1724 (x, vt) <-
@@ -1728,20 +1728,20 @@ telescopeSI ns mb = go []
1728 (\x -> flip (,) (Visible, x) <$> withSI (patVar ns)) 1728 (\x -> flip (,) (Visible, x) <$> withSI (patVar ns))
1729 mb 1729 mb
1730 ) 1730 )
1731 ((++[x]) *** (vt:)) <$> go (x: vs) 1731 ((x:) *** (vt:)) <$> go (x: vs)
1732 where 1732 where
1733 typedId v = (\f s -> (f,(v,s))) 1733 typedId v = (\f s -> (f,(v,s)))
1734 <$> withSI (patVar ns) 1734 <$> withSI (patVar ns)
1735 <*> localIndentation Gt {-TODO-} (dbf' (DBNamesC vs) <$> parseType ns mb) 1735 <*> localIndentation Gt {-TODO-} (dbf' (DBNamesC vs) <$> parseType ns mb)
1736 1736
1737telescopeDataFields :: Namespace -> P ([SIName], [(Visibility, SExp)]) 1737telescopeDataFields :: Namespace -> P ([SIName], [(Visibility, SExp)])
1738telescopeDataFields ns = {-telescopeSI ns Nothing-} go [] 1738telescopeDataFields ns = {-telescopeSI ns Nothing-} first reverse <$> go []
1739 where 1739 where
1740 go vs = option ([], []) $ do 1740 go vs = option ([], []) $ do
1741 (x, vt) <- do name <- withSI $ var (expNS ns) 1741 (x, vt) <- do name <- withSI $ var (expNS ns)
1742 term <- parseType ns Nothing 1742 term <- parseType ns Nothing
1743 return (name, (Visible, dbf' (DBNamesC vs) term)) 1743 return (name, (Visible, dbf' (DBNamesC vs) term))
1744 ((++[x]) *** (vt:)) <$> (comma *> go (x: vs) <|> pure ([], [])) 1744 ((x:) *** (vt:)) <$> (comma *> go (x: vs) <|> pure ([], []))
1745 1745
1746patternAtom ns = patternAtom' ns <&> \p -> (getPVars p, p) 1746patternAtom ns = patternAtom' ns <&> \p -> (getPVars p, p)
1747patternAtom' ns = 1747patternAtom' ns =