diff options
author | Andor Penzes <andor.penzes@gmail.com> | 2016-01-22 23:58:20 +0100 |
---|---|---|
committer | Andor Penzes <andor.penzes@gmail.com> | 2016-01-22 23:58:20 +0100 |
commit | 8e5df5a67b8a92064f3217ce1ca8bcec5884a408 (patch) | |
tree | a27667b89d8ac8ee54e61da521bd9f01979bf8c3 /src | |
parent | 72c6d50db8ea8f7527208efd191f15368651c328 (diff) |
Tweak telescope functions.
Diffstat (limited to 'src')
-rw-r--r-- | src/LambdaCube/Compiler/Infer.hs | 8 |
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 | |||
1718 | telescope ns mb = (DBNamesC *** id) <$> telescopeSI ns mb | 1718 | telescope ns mb = (DBNamesC *** id) <$> telescopeSI ns mb |
1719 | 1719 | ||
1720 | telescopeSI :: Namespace -> Maybe SExp -> P ([SIName], [(Visibility, SExp)]) -- todo: refactor to [(SIName, (Visibility, SExp))] | 1720 | telescopeSI :: Namespace -> Maybe SExp -> P ([SIName], [(Visibility, SExp)]) -- todo: refactor to [(SIName, (Visibility, SExp))] |
1721 | telescopeSI ns mb = go [] | 1721 | telescopeSI 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 | ||
1737 | telescopeDataFields :: Namespace -> P ([SIName], [(Visibility, SExp)]) | 1737 | telescopeDataFields :: Namespace -> P ([SIName], [(Visibility, SExp)]) |
1738 | telescopeDataFields ns = {-telescopeSI ns Nothing-} go [] | 1738 | telescopeDataFields 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 | ||
1746 | patternAtom ns = patternAtom' ns <&> \p -> (getPVars p, p) | 1746 | patternAtom ns = patternAtom' ns <&> \p -> (getPVars p, p) |
1747 | patternAtom' ns = | 1747 | patternAtom' ns = |