aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarvin Borner2022-08-30 23:17:29 +0200
committerMarvin Borner2022-08-30 23:17:29 +0200
commit7209f9dde5ea9085cf61a7210be836e1e7f8dcc7 (patch)
treef05f4b131735883e5dccc10e17d9546689670a52
parentea7b6562f41b4f8845828db7ee10e1f9036752e4 (diff)
Fixed prefix/mixfix usage as singleton function
-rw-r--r--src/Parser.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Parser.hs b/src/Parser.hs
index 984c276..15400f6 100644
--- a/src/Parser.hs
+++ b/src/Parser.hs
@@ -144,12 +144,18 @@ parseFunction = do
parseMixfix :: Parser Expression
parseMixfix = do
s <- sepBy1
- (try prefixAsMixfix <|> try operatorAsMixfix <|> singletonAsMixfix)
+ ( try prefixAsMixfix
+ <|> try prefixOperatorAsMixfix
+ <|> try operatorAsMixfix
+ <|> singletonAsMixfix
+ )
sc
pure $ MixfixChain s
- where
- prefixAsMixfix = MixfixExpression <$> parsePrefix
- operatorAsMixfix = MixfixOperator <$> mixfixOperator
+ where -- TODO: Rethink this.
+ prefixAsMixfix = MixfixExpression <$> parsePrefix
+ prefixOperatorAsMixfix =
+ MixfixExpression . Function <$> (prefixOperator <* char '‣')
+ operatorAsMixfix = MixfixOperator . MixfixFunction <$> some mixfixSome
singletonAsMixfix = MixfixExpression <$> parseSingleton
parsePrefix :: Parser Expression