diff options
| author | adelon <22380201+adelon@users.noreply.github.com> | 2024-06-10 23:50:39 +0200 |
|---|---|---|
| committer | adelon <22380201+adelon@users.noreply.github.com> | 2024-06-10 23:50:39 +0200 |
| commit | 3a1c6df56dd7b38c42caf7833025f3830a656aa1 (patch) | |
| tree | f53c4fc346aee67fb2159e46e1fda42f964debb1 | |
| parent | 9cdcc0e79a87186d4dc0c1f46ca3e7f723d0d1c6 (diff) | |
Dedupe helper function
| -rw-r--r-- | source/Syntax/Concrete.hs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/source/Syntax/Concrete.hs b/source/Syntax/Concrete.hs index bad9635..b51b738 100644 --- a/source/Syntax/Concrete.hs +++ b/source/Syntax/Concrete.hs @@ -241,7 +241,7 @@ grammar lexicon@Lexicon{..} = mdo asmLetStruct <- rule $ AsmLetStruct <$> (_let *> var <* _be <* _an) <*> structNounNameless asmLet <- rule $ asmLetNoun <|> asmLetNouns <|> asmLetIn <|> asmLetEq <|> asmLetThe <|> asmLetStruct asmSuppose <- rule $ AsmSuppose <$> (_suppose *> stmt) - asm <- rule $ assumptionList (asmLet <|> asmSuppose) <* _dot + asm <- rule $ andList1_ (asmLet <|> asmSuppose) <* _dot asms <- rule $ concat <$> many asm axiom <- rule $ Axiom <$> asms <* optional _then <*> stmt <* _dot @@ -406,7 +406,7 @@ andList1 item = ((:|) <$> item <*> many (_commaAnd *> item)) -- | Like 'andList1', but drops the information about nonemptiness. andList1_ :: Prod r Text (Located Token) a -> Prod r Text (Located Token) [a] -andList1_ item = toList <$> andList1 item +andList1_ item = NonEmpty.toList <$> andList1 item commaList :: Prod r Text (Located Token) a -> Prod r Text (Located Token) (NonEmpty a) @@ -421,9 +421,6 @@ commaList2 :: Prod r Text (Located Token) a -> Prod r Text (Located Token) (NonE commaList2 item = (:|) <$> item <* _comma <*> commaList_ item -assumptionList :: Prod r Text (Located Token) a -> Prod r Text (Located Token) [a] -assumptionList item = NonEmpty.toList <$> andList1 item - enumerated :: Prod r Text (Located Token) a -> Prod r Text (Located Token) [a] enumerated p = NonEmpty.toList <$> enumerated1 p |
